Skip to content
Snippets Groups Projects
Commit cfac8212 authored by Karsten Rink's avatar Karsten Rink
Browse files

Merge branch 'master' of github.com:ufz/ogs

Conflicts:
	BaseLib/uniqueInsert.h
	MeshLib/Node.h
parents bd1ba828 815b41d4
No related branches found
No related tags found
No related merge requests found
Showing
with 88 additions and 76 deletions
language: cpp
compiler:
- gcc
branches:
only:
- master
before_install:
- sudo apt-get install qt4-dev-tools libvtk5-dev libvtk5-qt4-dev libnetcdf-dev libshp-dev libgeotiff-dev
script: "mkdir build && cd build && cmake -DOGS_BUILD_GUI=ON .. && cmake .. && make"
notifications:
email:
- lars.bilke@ufz.de
\ No newline at end of file
......@@ -8,9 +8,9 @@ ADD_LIBRARY( BaseLib STATIC ${SOURCES})
SET_TARGET_PROPERTIES(BaseLib PROPERTIES LINKER_LANGUAGE CXX)
INCLUDE_DIRECTORIES(
../GeoLib
../MathLib
.
${CMAKE_SOURCE_DIR}/GeoLib
${CMAKE_SOURCE_DIR}/MathLib
.
)
# Add logog subdirectory and group its targets in a Visual Studio folder
......
......@@ -109,7 +109,7 @@ class Histogram
void setMaximum(const T& maximum) { _max = maximum; _dirty = true; }
const Data& getSortedData() const { return _data; }
const std::vector<size_t>& getBinCounts() const { return _histogram; }
const std::vector<std::size_t>& getBinCounts() const { return _histogram; }
const unsigned int& getNrBins() const { return _nr_bins; }
const T& getMinimum() const { return _min; }
const T& getMaximum() const { return _max; }
......@@ -118,7 +118,7 @@ class Histogram
void
prettyPrint(std::ostream& os, const unsigned int line_width = 16) const
{
const size_t count_max = *std::max_element(_histogram.begin(), _histogram.end());
const std::size_t count_max = *std::max_element(_histogram.begin(), _histogram.end());
for (unsigned int bin = 0; bin < _nr_bins; ++bin) {
os << "[" << _min + bin * _bin_width << ", " << _min + (bin + 1) * _bin_width << ")\t";
os << _histogram[bin] << "\t";
......@@ -133,7 +133,7 @@ class Histogram
protected:
Data _data;
const unsigned int _nr_bins;
std::vector<size_t> _histogram;
std::vector<std::size_t> _histogram;
T _min, _max; ///< Minimum and maximum input data values.
T _bin_width;
......
......@@ -52,7 +52,7 @@ template<typename T> std::string number2str(T d)
/**
* Converts a string into a number (double, float, int, ...)
* Example: size_t number (str2number<size_t> (str));
* Example: std::size_t number (str2number<std::size_t> (str));
* \param str string to be converted
* \return the number
*/
......@@ -92,7 +92,7 @@ void extractPath (std::string const& fname, std::string& path);
} // end namespace BaseLib
#ifdef MSVC
void correctScientificNotation(std::string filename, size_t precision = 0);
void correctScientificNotation(std::string filename, std::size_t precision = 0);
#endif
#endif //STRINGTOOLS_H
......@@ -29,13 +29,13 @@ namespace BaseLib {
* @param end ending index in the sorted vector of elements
* @param array the vector of elements
* @return the id of the element in the vector or, if not found,
* the value std::numeric_limits<size_t>::max()
* the value std::numeric_limits<std::size_t>::max()
*/
template <class T>
size_t searchElement (const T& key, size_t beg, size_t end, const std::vector<T>& array)
std::size_t searchElement (const T& key, std::size_t beg, std::size_t end, const std::vector<T>& array)
{
if (beg >= end) return std::numeric_limits<size_t>::max();
size_t m ((end+beg)/2);
if (beg >= end) return std::numeric_limits<std::size_t>::max();
std::size_t m ((end+beg)/2);
if (key == array[m]) {
return m;
......@@ -46,7 +46,7 @@ size_t searchElement (const T& key, size_t beg, size_t end, const std::vector<T>
return searchElement (key, m+1, end, array);
}
size_t searchElement (double const& val, size_t beg, size_t end, const std::vector<double>& array);
std::size_t searchElement (double const& val, std::size_t beg, std::size_t end, const std::vector<double>& array);
} // end namespace BaseLib
......
......@@ -20,10 +20,10 @@
namespace BaseLib {
void printList (std::list<size_t> const& mylist, std::string const& title)
void printList (std::list<std::size_t> const& mylist, std::string const& title)
{
std::cout << title << std::endl;
for (std::list<size_t>::const_iterator my_it (mylist.begin());
for (std::list<std::size_t>::const_iterator my_it (mylist.begin());
my_it != mylist.end(); my_it++) {
std::cout << *my_it << " ";
}
......
......@@ -62,10 +62,10 @@ void quickSort(T* array, unsigned beg, unsigned end)
* @return
*/
template <typename T1, typename T2>
size_t partition_(T1* array, size_t beg, size_t end, T2 *second_array)
std::size_t partition_(T1* array, std::size_t beg, std::size_t end, T2 *second_array)
{
size_t i = beg + 1;
size_t j = end - 1;
std::size_t i = beg + 1;
std::size_t j = end - 1;
T1 m = array[beg];
for (;;) {
......@@ -95,10 +95,10 @@ size_t partition_(T1* array, size_t beg, size_t end, T2 *second_array)
* @param second_array the second array is permuted according to the sort process of array
*/
template <typename T1, typename T2>
void quicksort(T1* array, size_t beg, size_t end, T2* second_array)
void quicksort(T1* array, std::size_t beg, std::size_t end, T2* second_array)
{
if (beg < end) {
size_t p = partition_(array, beg, end, second_array);
std::size_t p = partition_(array, beg, end, second_array);
quicksort(array, beg, p, second_array);
quicksort(array, p+1, end, second_array);
}
......@@ -114,15 +114,15 @@ namespace BaseLib {
template <typename T>
class Quicksort {
public:
Quicksort (std::vector<T>& array, size_t beg, size_t end, std::vector<size_t>& perm)
Quicksort (std::vector<T>& array, std::size_t beg, std::size_t end, std::vector<std::size_t>& perm)
{
quicksort (array, beg, end, perm);
}
private:
size_t partition_(std::vector<T>& array, size_t beg, size_t end, std::vector<size_t>& perm)
std::size_t partition_(std::vector<T>& array, std::size_t beg, std::size_t end, std::vector<std::size_t>& perm)
{
size_t i = beg + 1;
size_t j = end - 1;
std::size_t i = beg + 1;
std::size_t j = end - 1;
T m = array[beg];
for (;;) {
......@@ -142,10 +142,10 @@ private:
return j;
}
void quicksort(std::vector<T>& array, size_t beg, size_t end, std::vector<size_t>& perm)
void quicksort(std::vector<T>& array, std::size_t beg, std::size_t end, std::vector<std::size_t>& perm)
{
if (beg < end) {
size_t p = partition_(array, beg, end, perm);
std::size_t p = partition_(array, beg, end, perm);
quicksort(array, beg, p, perm);
quicksort(array, p+1, end, perm);
}
......@@ -156,21 +156,21 @@ private:
template <typename T>
class Quicksort <T *> {
public:
Quicksort (std::vector<T*>& array, size_t beg, size_t end, std::vector<size_t>& perm)
Quicksort (std::vector<T*>& array, std::size_t beg, std::size_t end, std::vector<std::size_t>& perm)
{
quicksort (array, beg, end, perm);
}
Quicksort (std::vector<size_t>& perm, size_t beg, size_t end, std::vector<T*>& array)
Quicksort (std::vector<std::size_t>& perm, std::size_t beg, std::size_t end, std::vector<T*>& array)
{
quicksort (perm, beg, end, array);
}
private:
size_t partition_(std::vector<T*>& array, size_t beg, size_t end, std::vector<size_t>& perm)
std::size_t partition_(std::vector<T*>& array, std::size_t beg, std::size_t end, std::vector<std::size_t>& perm)
{
size_t i = beg + 1;
size_t j = end - 1;
std::size_t i = beg + 1;
std::size_t j = end - 1;
T* m = array[beg];
for (;;) {
......@@ -190,20 +190,20 @@ private:
return j;
}
void quicksort(std::vector<T*>& array, size_t beg, size_t end, std::vector<size_t>& perm)
void quicksort(std::vector<T*>& array, std::size_t beg, std::size_t end, std::vector<std::size_t>& perm)
{
if (beg < end) {
size_t p = partition_(array, beg, end, perm);
std::size_t p = partition_(array, beg, end, perm);
quicksort(array, beg, p, perm);
quicksort(array, p+1, end, perm);
}
}
size_t partition_(std::vector<size_t> &perm, size_t beg, size_t end, std::vector<T*>& array)
std::size_t partition_(std::vector<std::size_t> &perm, std::size_t beg, std::size_t end, std::vector<T*>& array)
{
size_t i = beg + 1;
size_t j = end - 1;
size_t m = perm[beg];
std::size_t i = beg + 1;
std::size_t j = end - 1;
std::size_t m = perm[beg];
for (;;) {
while ((i < end) && (perm[i] <= m))
......@@ -222,10 +222,10 @@ private:
return j;
}
void quicksort(std::vector<size_t>& perm, size_t beg, size_t end, std::vector<T*>& array)
void quicksort(std::vector<std::size_t>& perm, std::size_t beg, std::size_t end, std::vector<T*>& array)
{
if (beg < end) {
size_t p = partition_(perm, beg, end, array);
std::size_t p = partition_(perm, beg, end, array);
quicksort(perm, beg, p, array);
quicksort(perm, p+1, end, array);
}
......
......@@ -28,11 +28,11 @@ public:
: FEMCondition(cond, FEMCondition::BOUNDARY_CONDITION) {};
~BoundaryCondition() {}
size_t getTimType() const {return _tim_type; }
void setTimType(size_t value) { _tim_type = value; }
std::size_t getTimType() const {return _tim_type; }
void setTimType(std::size_t value) { _tim_type = value; }
private:
size_t _tim_type;
std::size_t _tim_type;
};
#endif //BOUNDARYCONDITION_H
......@@ -59,7 +59,7 @@ public:
CondType getCondType() const { return _type; }
/// Returns the value(s) for the distribution
const std::vector<size_t> getDisNodes() const { return _disNodes; }
const std::vector<std::size_t> getDisNodes() const { return _disNodes; }
/// Returns the value(s) for the distribution
const std::vector<double> getDisValues() const { return _disValues; }
......@@ -74,7 +74,7 @@ public:
void setConstantDisValue(double disValue) {_disValues.clear(); _disValues.push_back(disValue); }
/// Sets a vector of values specifying the distribution.
void setDisValues(const std::vector<size_t> &disNodes, const std::vector<double> &disValues)
void setDisValues(const std::vector<std::size_t> &disNodes, const std::vector<double> &disValues)
{
_disNodes = disNodes;
_disValues = disValues;
......@@ -82,7 +82,7 @@ public:
/// Sets a vector of values specifying the distribution.
/// The first value specifies the point id, the second the value for that point.
void setDisValues(const std::vector< std::pair<size_t, double> > &dis_values);
void setDisValues(const std::vector< std::pair<std::size_t, double> > &dis_values);
/// Removes all distribution values
void clearDisValues() { _disValues.resize(0); };
......@@ -96,7 +96,7 @@ public:
protected:
CondType _type;
std::string _geoName;
std::vector<size_t> _disNodes;
std::vector<std::size_t> _disNodes;
std::vector<double> _disValues;
std::string _associated_geometry;
};
......
......@@ -28,15 +28,15 @@ public:
: FEMCondition(cond, FEMCondition::SOURCE_TERM) {};
~SourceTerm() {}
size_t getTimType() const {return _tim_type; }
void setTimType(size_t value) { _tim_type = value; }
std::size_t getTimType() const {return _tim_type; }
void setTimType(std::size_t value) { _tim_type = value; }
// Legacy function (only required for ascii st-files): reads values for 'direct' source terms
static void getDirectNodeValues(const std::string &filename,
std::vector< std::pair<size_t, double> > &nodes_values);
std::vector< std::pair<std::size_t, double> > &nodes_values);
private:
size_t _tim_type;
std::size_t _tim_type;
};
#endif //SOURCETERM_H
......@@ -70,7 +70,7 @@ private:
static std::vector<std::string> readSoilIDfromFile(const std::string &filename);
/// Finds the ID assigned to soilName or creates a new one ( this method is called from writeBoreholeToGMS() )
static size_t getSoilID(std::vector<std::string> &soilID, std::string &soilName);
static std::size_t getSoilID(std::vector<std::string> &soilID, std::string &soilName);
};
#endif /* GMSINTERFACE_H_ */
......@@ -30,13 +30,13 @@ namespace FileIO {
class GMSHAdaptiveMeshDensity: public GMSHMeshDensityStrategy {
public:
GMSHAdaptiveMeshDensity(double pnt_density, double station_density, size_t max_pnts_per_leaf);
GMSHAdaptiveMeshDensity(double pnt_density, double station_density, std::size_t max_pnts_per_leaf);
virtual ~GMSHAdaptiveMeshDensity();
void init(std::vector<GeoLib::Point const*> const& pnts);
double getMeshDensityAtPoint(GeoLib::Point const*const pnt) const;
void addPoints(std::vector<GeoLib::Point const*> const& pnts);
double getMeshDensityAtStation(GeoLib::Point const*const) const;
void getSteinerPoints (std::vector<GeoLib::Point*> & pnts, size_t additional_levels = 0) const;
void getSteinerPoints (std::vector<GeoLib::Point*> & pnts, std::size_t additional_levels = 0) const;
#ifndef NDEBUG
void getQuadTreeGeometry(std::vector<GeoLib::Point*> &pnts, std::vector<GeoLib::Polyline*> &plys) const;
#endif
......@@ -44,7 +44,7 @@ public:
private:
double _pnt_density;
double _station_density;
size_t _max_pnts_per_leaf;
std::size_t _max_pnts_per_leaf;
GeoLib::QuadTree<GeoLib::Point> *_quad_tree;
};
......
......@@ -64,7 +64,7 @@ public:
GMSHInterface (GeoLib::GEOObjects & geo_objs,
bool include_stations_as_constraints,
GMSH::MeshDensityAlgorithm mesh_density_algorithm,
double param1, double param2, size_t param3,
double param1, double param2, std::size_t param3,
std::vector<std::string> & selected_geometries);
/**
......@@ -95,8 +95,8 @@ private:
void writePoints(std::ostream& out) const;
size_t _n_lines;
size_t _n_plane_sfc;
std::size_t _n_lines;
std::size_t _n_plane_sfc;
GeoLib::GEOObjects & _geo_objs;
std::vector<std::string>& _selected_geometries;
......
......@@ -14,14 +14,14 @@ namespace FileIO {
class GMSHLine {
public:
GMSHLine(size_t start_point_id, size_t end_point_id);
GMSHLine(std::size_t start_point_id, std::size_t end_point_id);
virtual ~GMSHLine();
void write(std::ostream &os, size_t id) const;
void resetLineData(size_t start_point_id, size_t end_point_id);
void write(std::ostream &os, std::size_t id) const;
void resetLineData(std::size_t start_point_id, std::size_t end_point_id);
private:
size_t _start_pnt_id;
size_t _end_pnt_id;
std::size_t _start_pnt_id;
std::size_t _end_pnt_id;
};
}
......
......@@ -22,7 +22,7 @@ public:
void addLine(GMSHLine* line);
bool isSurface() const { return _is_sfc; }
void setSurface(bool is_sfc) { _is_sfc = is_sfc; }
void write(std::ostream &os, size_t offset, size_t sfc_offset = 0) const;
void write(std::ostream &os, std::size_t offset, std::size_t sfc_offset = 0) const;
private:
std::vector<GMSHLine*> _lines;
......
......@@ -19,7 +19,7 @@ namespace FileIO {
class GMSHPoint : public GeoLib::PointWithID {
public:
GMSHPoint(GeoLib::Point const& pnt, size_t id, double mesh_density);
GMSHPoint(GeoLib::Point const& pnt, std::size_t id, double mesh_density);
virtual ~GMSHPoint();
void write(std::ostream &os) const;
private:
......
......@@ -65,11 +65,11 @@ public:
*/
void createGMSHPoints(std::vector<FileIO::GMSHPoint*> & gmsh_pnts) const;
virtual void writeLineLoop(size_t &line_offset, size_t &sfc_offset, std::ostream& out) const;
void writeSubPolygonsAsLineConstraints(size_t &line_offset, size_t sfc_number, std::ostream& out) const;
virtual void writeLineConstraints(size_t &line_offset, size_t sfc_number, std::ostream& out) const;
void writeStations(size_t & pnt_id_offset, size_t sfc_number, std::ostream& out) const;
void writeAdditionalPointData(size_t & pnt_id_offset, size_t sfc_number, std::ostream& out) const;
virtual void writeLineLoop(std::size_t &line_offset, std::size_t &sfc_offset, std::ostream& out) const;
void writeSubPolygonsAsLineConstraints(std::size_t &line_offset, std::size_t sfc_number, std::ostream& out) const;
virtual void writeLineConstraints(std::size_t &line_offset, std::size_t sfc_number, std::ostream& out) const;
void writeStations(std::size_t & pnt_id_offset, std::size_t sfc_number, std::ostream& out) const;
void writeAdditionalPointData(std::size_t & pnt_id_offset, std::size_t sfc_number, std::ostream& out) const;
private:
void getPointsFromSubPolygons(std::vector<GeoLib::Point const*>& pnts);
......
......@@ -70,8 +70,8 @@ private:
* @param boundary_markers have the nodes boundary information (output)
* @return true, if the file header is read, false if the method detects an error
*/
bool parseNodesFileHeader(std::string &line, size_t& n_nodes, size_t& dim,
size_t& n_attributes, bool& boundary_markers) const;
bool parseNodesFileHeader(std::string &line, std::size_t& n_nodes, std::size_t& dim,
std::size_t& n_attributes, bool& boundary_markers) const;
/**
* method parses the lines reading the nodes from TetGen nodes file
* @param ins the input stream (input)
......@@ -79,7 +79,7 @@ private:
* @param dim the spatial dimension of the node (input)
* @return true, if the nodes are read, false if the method detects an error
*/
bool parseNodes(std::ifstream& ins, size_t n_nodes, size_t dim);
bool parseNodes(std::ifstream& ins, std::size_t n_nodes, std::size_t dim);
/**
* Method reads the elements from stream and stores them in the element vector of the mesh class.
......@@ -96,7 +96,7 @@ private:
* @param region_attribute is on output true, if there
* @return
*/
bool parseElementsFileHeader(std::string &line, size_t& n_tets, size_t& n_nodes_per_tet,
bool parseElementsFileHeader(std::string &line, std::size_t& n_tets, std::size_t& n_nodes_per_tet,
bool& region_attribute) const;
/**
* Method parses the tetrahedras and put them in the element vector of the mesh class.
......@@ -106,7 +106,7 @@ private:
* @param region_attribute if region attribute is true, region information is read
* @return true, if the tetrahedras are read, false if the method detects an error
*/
bool parseElements(std::ifstream& ins, size_t n_tets, size_t n_nodes_per_tet,
bool parseElements(std::ifstream& ins, std::size_t n_tets, std::size_t n_nodes_per_tet,
bool region_attribute);
/**
......
......@@ -33,7 +33,7 @@ private:
std::vector<GeoLib::Point*>* pnt_vec;
std::vector<GeoLib::Point*>* well_vec;
std::vector<GeoLib::Polyline*>* ply_vec;
static const size_t MAX_COLS_PER_ROW = 256;
static const std::size_t MAX_COLS_PER_ROW = 256;
};
} // end namespace FileIO
......
......@@ -73,7 +73,7 @@ protected:
std::string _exportName;
std::string _schemaName;
std::map<size_t, size_t> _idx_map;
std::map<std::size_t, std::size_t> _idx_map;
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment