Skip to content

Commit

Permalink
Release 5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
(no author) authored and bilke committed Jan 25, 2016
0 parents commit 567af77
Show file tree
Hide file tree
Showing 1,032 changed files with 600,109 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.h hooks.style
*.cpp hooks.style
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FindGit.cmake
Release/
build*/
Build*/
benchOut.txt
benchSummary.csv
svnInfo.txt
CMakeLists.txt.user
*.yml~
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ThirdParty/cvode"]
path = ThirdParty/cvode
url = https://github.com/ufz/cvode.git
28 changes: 28 additions & 0 deletions Base/BuildInfo.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* \file BuildInfo.h.in
* 24/08/2010 LB Initial implementation
* #defines which gets set through CMake
*/

#ifndef BUILDINFO_H
#define BUILDINFO_H

#cmakedefine CMAKE_CMD_ARGS "${CMAKE_CMD_ARGS}"
#cmakedefine SVN_REVISION "${SVN_REVISION}"
#cmakedefine GIT_COMMIT_INFO "${GIT_COMMIT_INFO}"
#cmakedefine GIT_BRANCH_INFO "${GIT_BRANCH_INFO}"
#cmakedefine BUILD_TIMESTAMP "${BUILD_TIMESTAMP}"
#cmakedefine CMAKE_RUN_TIMESTAMP ""
#cmakedefine CMAKE_SYSTEM "${CMAKE_SYSTEM}-x${BITS}"
#cmakedefine CMAKE_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}"
#cmakedefine CMAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER}"
#cmakedefine GCC_VERSION "${GCC_VERSION}"
#cmakedefine CMAKE_GENERATOR "${CMAKE_GENERATOR}"
#cmakedefine CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}"
#cmakedefine CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}"
#cmakedefine CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}"
#cmakedefine CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}"

#define SOLVER_PACKAGE_NAME "${SOLVER_PKG_NAME}"

#endif // BUILDINFO_H
53 changes: 53 additions & 0 deletions Base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
set( HEADERS
binarySearch.h
break.h
Configure.h.in
DateTools.h
display.h
FileFinder.h
FileTools.h
makros.h
memory.h
MemWatch.h
printList.h
quicksort.h
StringTools.h
swap.h
timer.h
uniqueListInsert.h
wait.h
)

set( SOURCES
binarySearch.cpp
break.cpp
DateTools.cpp
display.cpp
FileTools.cpp
makros.cpp
memory.cpp
MemWatch.cpp
StringTools.cpp
timer.cpp
)

if (PARALLEL_USE_MPI)
message (STATUS "include splitmpi-comm" )
set(HEADERS ${HEADERS} SplitMPI_Communicator.h )
set(SOURCES ${SOURCES} SplitMPI_Communicator.cpp )
endif ()

# Create the library
add_library( Base STATIC ${HEADERS} ${SOURCES} )

set_target_properties(Base PROPERTIES LINKER_LANGUAGE CXX)

include_directories(
${CMAKE_SOURCE_DIR}/Base
${CMAKE_SOURCE_DIR}/FEM
)

if(OGS_BUILD_CORRECT_SCIENTIFIC)
# Create utility executable
add_executable( correctScientificNotation CorrectScientificNotationMain.cpp )
endif()
25 changes: 25 additions & 0 deletions Base/Configure.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* \file Configure.h.in
*
* #defines which gets set through CMake
*/
#ifndef CONFIGURE_H
#define CONFIGURE_H

#define OGS_QT_VERSION ${QT_VERSION_MAJOR}${QT_VERSION_MINOR}
#define SOURCEPATH "${CMAKE_SOURCE_DIR}"
#define BUILDPATH "${CMAKE_BINARY_DIR}"
#define TESTDATAPATH "${TESTDATA_DIR_FOUND}"

#cmakedefine OGS_VERSION "${OGS_VERSION}"
#cmakedefine OGS_DATE "${OGS_DATE}"
#cmakedefine QT_USE_QTXMLPATTERNS

// for tests
#cmakedefine OGS_EXECUTABLE "${OGS_EXECUTABLE}"
#define PUT_TMP_DIR_IN "${PROJECT_BINARY_DIR}/tests/"
#cmakedefine JENKINS_URL "${JENKINS_URL}"
#cmakedefine JENKINS_JOB_NAME "${JENKINS_JOB_NAME}"
#cmakedefine PROCESSOR_COUNT ${PROCESSOR_COUNT}

#endif // CONFIGURE_H
22 changes: 22 additions & 0 deletions Base/CorrectScientificNotationMain.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* 28/5/2010 LB Initial implementation
*
* \copyright
* Copyright (c) 2015, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/
#include "StringTools.h"

int main( int argc, const char* argv[] )
{
if (argc < 2)
{
std::cout << "Usage: correctScientificNotation filename" << std::endl;
return 1;
}

std::string filename = argv[1];
correctScientificNotation(filename);
}
111 changes: 111 additions & 0 deletions Base/DateTools.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* DateTools.cpp
*
* Created on: Jun 16, 2010
* Author: KR Initial implementation (in header file)
* TF moved implementation to source file
* \copyright
* Copyright (c) 2015, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/

#include "DateTools.h"
#include <cmath>
#include <cstdlib>
#include <iostream>

int date2int(int y, int m, int d)
{
if ( (y < 1000 || y > 9999) || (m < 1 || m > 12) || (d < 1 || d > 31) )
{
std::cout << "Error: date2double() -- input not in expected format." << "\n";
return 0;
}

int ddate(0);
ddate = y * 10000;
ddate += (m * 100);
ddate += d;

return ddate;
}

std::string int2date(int date)
{
if (date>10000000 && date<22000000)
{
int y = static_cast<int>(floor(date/10000.0));
int m = static_cast<int>(floor((date-(y*10000))/100.0));
int d = date-(y*10000)-(m*100);
std::stringstream ss;
if (d<10)
ss << "0";
ss << d << ".";
if (m<10)
ss << "0";
ss << m << "." << y;
return ss.str();
}
return "";
}

std::string date2string(double ddate)
{
if (ddate < 10000101 || ddate > 99991231)
{
std::cout << "Error: date2String() -- input not in expected format." << "\n";
return "0.0.0000";
}

int rest (static_cast<int>(ddate));
int y = static_cast<int>(floor(rest / 10000.0));
rest = rest % (y * 10000);
int m = static_cast<int>(floor(rest / 100.0));
if (m < 1 || m > 12)
std::cout << "Warning: date2String() -- month not in [1:12]" << "\n";
rest = rest % (m * 100);
int d = rest;
if (d < 1 || d > 31)
std::cout << "Warning: date2String() -- day not in [1:31]" << "\n";

std::string day = number2str(d);
if (d < 10)
day = "0" + day;
std::string month = number2str(m);
if (m < 10)
month = "0" + month;
std::string s = number2str(y) + "-" + month + "-" + day;
return s;
}

int strDate2int(const std::string &s)
{
std::string str(s);
if (s.length() > 10)
str = s.substr(0,10);
size_t sep ( str.find(".",0) );
int d ( atoi(str.substr(0, sep).c_str()) );
size_t sep2 ( str.find(".", sep + 1) );
int m ( atoi(str.substr(sep + 1,sep2 - (sep + 1)).c_str()) );
int y ( atoi(str.substr(sep2 + 1, s.length() - (sep2 + 1)).c_str()) );
return date2int(y, m, d);
}

int xmlDate2int(const std::string &s)
{
if (s.length() == 10)
{
int d = atoi(s.substr(8,2).c_str());
if (d < 1 || d > 31)
std::cout << "Warning: xmlDate2double() -- day not in [1:31]" << "\n";
int m = atoi(s.substr(5,2).c_str());
if (m < 1 || m > 12)
std::cout << "Warning: xmlDate2double() -- month not in [1:12]" <<
"\n";
int y = atoi(s.substr(0,4).c_str());
return date2int(y, m, d);
}
return 0;
}
53 changes: 53 additions & 0 deletions Base/DateTools.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* \file DateTools.h
* 22/01/2010 KR Initial implementation
* \copyright
* Copyright (c) 2015, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/

#ifndef DATETOOLS_H
#define DATETOOLS_H

#include "StringTools.h"
#include <string>

/**
* Converts three integers representing a date into a double.
* Note: It is not really checked if the date actually makes sense.
*/
int date2int(int y, int m, int d);

/**
* Converts an integer to a string date "dd.mm.yyyy"
* Note: (Almost) no checks are performed if the int makes sense as a date.
*/
std::string int2date(int date);

/**
* Converts a double representing a date into a string.
* Note: It is not really checked if the date actually makes sense.
* \param ddate Number containing date in double format yyyymmdd
* \return A string containing the date in format "dd.mm.yyyy".
*/
std::string date2string(double ddate);

/**
* Converts a string containing a date into a double.
* Note: It is not really checked if the date actually makes sense.
* \param s String containing the date, the expected format is "dd.mm.yyyy".
* \return A number representing the date as dd.mm.yyyy.
*/
int strDate2int(const std::string &s);

/**
* Converts a string containing a date into a double.
* Note: It is not really checked if the date actually makes sense.
* \param s String containing the date, the expected format is conform to the xml date type, i.e. "yyyy-mm-dd".
* \return A number representing the date as yyyymmdd.
*/
int xmlDate2int(const std::string &s);

#endif //DATETOOLS_H
64 changes: 64 additions & 0 deletions Base/FileFinder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* \file FileFinder.h
* 26/10/2010 KR Initial implementation
* \copyright
* Copyright (c) 2015, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*/

#ifndef FILEFINDER_H
#define FILEFINDER_H

#include <fstream>
#include <iostream>
#include <list>
#include <string>

/**
* FileFinder stores a list of directories and will return the complete path
* for a given filename if the corresponding file is found in any of these
* directories.
*/
class FileFinder
{
public:
/// Constructor
FileFinder() {}

/**
* \brief Adds another directory to the search-space.
* If the given directory does not end with a slash one will be appended.
*/
void addDirectory(std::string dir)
{
if (dir[dir.size() - 1] != '/') dir.append("/");
_directories.push_back(dir);
}

/**
* Given a filename, this method will return the complete path where this file can be found.
* If the file is located in more than one of the directories in the search list, only the
* first location will be returned.
*/
std::string getPath(std::string filename)
{
if (_directories.empty()) std::cout <<
"Error: FileFinder::getPath() -- directory list is empty." << "\n";
for (std::list<std::string>::iterator it = _directories.begin();
it != _directories.end(); ++it)
{
std::string testDir(*it);
std::ifstream is(testDir.append(filename).c_str());
if (is.good()) return testDir;
}
std::cout << "Error: FileFinder::getPath() -- file not found." << "\n";
return filename;
}

private:

std::list<std::string> _directories;
};
#endif // FILEFINDER_H
Loading

0 comments on commit 567af77

Please sign in to comment.