diff --git a/FileIO/MeshIO.cpp b/FileIO/MeshIO.cpp index 7ea88cbbdebf4ea2add0bfb0bcc1eefc38892892..8534168995b5be1eef7e977092c55341da3e420a 100644 --- a/FileIO/MeshIO.cpp +++ b/FileIO/MeshIO.cpp @@ -129,7 +129,7 @@ MeshLib::Element* MeshIO::readElement(const std::string& line, const std::vector switch(elem_type) { - case MshElemType::LINE: + case MshElemType::EDGE: for (int i = 0; i < 2; i++) ss >> idx[i]; elem = new MeshLib::Edge(nodes[idx[0]], nodes[idx[1]], patch_index); diff --git a/GeoLib/SensorData.h b/GeoLib/SensorData.h index 1a75aa0db4609b979059046a3b8e272b447b2042..22246fcaecc5823ec1a49eef4c350acdacf525ec 100644 --- a/GeoLib/SensorData.h +++ b/GeoLib/SensorData.h @@ -18,8 +18,12 @@ #include <string> #include <vector> -/// Possible types of input data for time series sensor data. -/// Implementation as Enum for specific implementations later on. +/** + * Possible types of input data for time series sensor data. + * Implementation as Enum for specific implementations later on. + * + * \sa SensorData + */ struct SensorDataType { enum type { @@ -31,6 +35,12 @@ struct SensorDataType }; }; +/** + * Possible types of time specification. + * In addition to the usual units we added 'DATE' for specification of dates + * in the format 'dd.mm.yyyy' as well as 'DATETIME' in the format + * 'dd.mm.yyyy.hh.mm.ss'. + */ struct TimeStepType { enum type { diff --git a/GeoLib/Station.h b/GeoLib/Station.h index 11fb36c475ecb694a99c58e08e050ee30011583b..0005b310a8a3abec5bed8928ad0bfb8651c804b0 100644 --- a/GeoLib/Station.h +++ b/GeoLib/Station.h @@ -29,14 +29,14 @@ namespace GeoLib /** * \ingroup GeoLib * - * \brief An observation station as a geometric object (i.e. basically a Point with some additional information. + * \brief A Station (observation site) is basically a Point with some additional information. * - * An observation station as a geometric object. A station is basically a point object - * with some additional information. This may include a name, a stratigraphy (only for the derived class StationBore), - * time series data (as a SensorData-object), etc. + * Additional information is largely optional (except for a name, but even this may be empty). + * It may include a name, a stratigraphy (only for the derived class StationBore), + * time series data from data loggers (as a SensorData-object), etc. * * Notes concerning the property-system used in this class: - * Variables of Station and derived classes can be defined to be "properties" of this class. + * Variables of Station and derived classes can be defined to be "properties" of this class (this is entirely optional!). * Certain functions in the GUI allow you to modify aspects of the visualisation based on these * properties (e.g. filtering operations such as "display only boreholes drilled after 1990 with a * depth between 400-800m"). diff --git a/MeshLib/Elements/Cell.cpp b/MeshLib/Elements/Cell.cpp index 7c1a9f0f5881aa79602c793d5aa9709c90f84233..bb551fdaa0a33075ac3af8c0dc18c29922c1dcc2 100644 --- a/MeshLib/Elements/Cell.cpp +++ b/MeshLib/Elements/Cell.cpp @@ -29,6 +29,14 @@ Cell::~Cell() delete[] this->_neighbors; } +bool Cell::isOnSurface() const +{ + unsigned n (this->getNNeighbors()); + for (unsigned i(0); i<n; i++) + if (!this->_neighbors[i]) + return true; + return false; +} } diff --git a/MeshLib/Elements/Cell.h b/MeshLib/Elements/Cell.h index d3d02df3fb71514c16073853329da7b5783d2d4e..e07ca0adf0dcf406835870814ead2c4df7072b6e 100644 --- a/MeshLib/Elements/Cell.h +++ b/MeshLib/Elements/Cell.h @@ -14,6 +14,7 @@ #define CELL_H_ #include "Element.h" +#include "Face.h" namespace MeshLib { @@ -32,6 +33,9 @@ public: /// Get the volume of this 3d element. virtual double getVolume() const { return _volume; }; + /// Returns true if the cell is somewhere on the mesh surface and false otherwise. + bool isOnSurface() const; + /// Destructor virtual ~Cell(); diff --git a/MeshLib/Elements/Edge.cpp b/MeshLib/Elements/Edge.cpp index efbb774d2b08d22acde5e29da8b83e78e12d23c9..fd922a85c2b21c54196a103a9878604c126c1272 100644 --- a/MeshLib/Elements/Edge.cpp +++ b/MeshLib/Elements/Edge.cpp @@ -18,14 +18,14 @@ namespace MeshLib { Edge::Edge(Node* nodes[2], unsigned value) - : Element(MshElemType::LINE, value) + : Element(MshElemType::EDGE, value) { _nodes = nodes; this->_length = this->computeLength(); } Edge::Edge(Node* n0, Node* n1, unsigned value) - : Element(MshElemType::LINE, value) + : Element(MshElemType::EDGE, value) { _nodes = new Node*[2]; _nodes[0] = n0; @@ -35,7 +35,7 @@ Edge::Edge(Node* n0, Node* n1, unsigned value) } Edge::Edge(const Edge &edge) - : Element(MshElemType::LINE, edge.getValue()) + : Element(MshElemType::EDGE, edge.getValue()) { _nodes = new Node*[2]; _nodes[0] = edge._nodes[0]; diff --git a/MeshLib/Elements/Element.h b/MeshLib/Elements/Element.h index 33abe67e144a72ee17049f180985a86715c9609e..fe665baf358ebb9b6f5c595ff192dee0dd42d68b 100644 --- a/MeshLib/Elements/Element.h +++ b/MeshLib/Elements/Element.h @@ -47,10 +47,10 @@ public: /// Get dimension of the mesh element. virtual unsigned getDimension() const = 0; - /// Returns the edge i of the element. + /// Returns the i-th edge of the element. const Element* getEdge(unsigned i) const; - /// Returns the face i of the element. + /// Returns the i-th face of the element. virtual const Element* getFace(unsigned i) const = 0; /// Get the number of edges for this element. diff --git a/MeshLib/Elements/Face.cpp b/MeshLib/Elements/Face.cpp index cab9b9ece368a11d3f7894335f0b425982e055d6..d3d097fe2fdeadbea18d8e3d32171ace0e9bd898 100644 --- a/MeshLib/Elements/Face.cpp +++ b/MeshLib/Elements/Face.cpp @@ -12,6 +12,10 @@ #include "Face.h" #include "Edge.h" +#include "Node.h" + +#include "MathTools.h" + namespace MeshLib { /* @@ -30,7 +34,18 @@ Face::~Face() delete[] this->_neighbors; } - +const double* Face::getSurfaceNormal() const +{ + const double edge1[3] = { (*this->_nodes[0])[0]-(*this->_nodes[1])[0], + (*this->_nodes[0])[1]-(*this->_nodes[1])[1], + (*this->_nodes[0])[2]-(*this->_nodes[1])[2] }; + const double edge2[3] = { (*this->_nodes[1])[0]-(*this->_nodes[2])[0], + (*this->_nodes[1])[1]-(*this->_nodes[2])[1], + (*this->_nodes[1])[2]-(*this->_nodes[2])[2] }; + double normal[3]; + MathLib::crossProd(edge1, edge2, normal); + return normal; +} } diff --git a/MeshLib/Elements/Face.h b/MeshLib/Elements/Face.h index f3866aebd07a0e09ea09da2adb5bad77e323d3da..1aa9e38f739405b9d03d126b76a2954774318c99 100644 --- a/MeshLib/Elements/Face.h +++ b/MeshLib/Elements/Face.h @@ -15,6 +15,7 @@ #include "Element.h" + namespace MeshLib { /** @@ -41,6 +42,9 @@ public: /// 2D elements have no faces. unsigned getNFaces() const { return 0; }; + /// Returns the surface normal of a 2D element. + const double* getSurfaceNormal() const; + /// Destructor virtual ~Face(); diff --git a/MeshLib/MshEnums.cpp b/MeshLib/MshEnums.cpp index 0833bd0be24f447fed42699d84fd93916050811d..ac21c6a19cb7d6cc106d4fa3056903c40d1e88c2 100644 --- a/MeshLib/MshEnums.cpp +++ b/MeshLib/MshEnums.cpp @@ -14,7 +14,7 @@ const std::string MshElemType2String(const MshElemType::type t) { - if (t == MshElemType::LINE) + if (t == MshElemType::EDGE) return "line"; if (t == MshElemType::QUAD) return "quad"; @@ -34,7 +34,7 @@ const std::string MshElemType2String(const MshElemType::type t) MshElemType::type String2MshElemType(const std::string &s) { if (s.compare("line") == 0) - return MshElemType::LINE; + return MshElemType::EDGE; if (s.compare("quad") == 0) return MshElemType::QUAD; if (s.compare("hex") == 0) diff --git a/MeshLib/MshEnums.h b/MeshLib/MshEnums.h index 431e2f8be71bf0a866085a145d9ed69afffd4845..765a4dcfd9ca0c9f3c6798e0cb1013a59cb22ad9 100644 --- a/MeshLib/MshEnums.h +++ b/MeshLib/MshEnums.h @@ -22,7 +22,7 @@ struct MshElemType { enum type { INVALID, - LINE, + EDGE, QUAD, HEXAHEDRON, TRIANGLE,