diff --git a/Applications/FileIO/GocadIO/Layer.cpp b/Applications/FileIO/GocadIO/Layer.cpp index b3233392645715850171563321c2f7b8ca6420e7..7ce3f6bd2a5c92d98d7eb62444111c679cb302ff 100644 --- a/Applications/FileIO/GocadIO/Layer.cpp +++ b/Applications/FileIO/GocadIO/Layer.cpp @@ -22,12 +22,11 @@ namespace Gocad std::ostream& operator<<(std::ostream& os, Layer const& l) { std::copy(l.regions.begin(), l.regions.end(), - std::ostream_iterator<Gocad::Region>(os, " ")); + std::ostream_iterator<Region>(os, " ")); return os; } -Layer parseLayer(std::string const& line, - std::vector<Gocad::Region> const& regions) +Layer parseLayer(std::string const& line, std::vector<Region> const& regions) { std::istringstream iss(line); std::istream_iterator<std::string> it(iss); @@ -45,7 +44,7 @@ Layer parseLayer(std::string const& line, { auto const& region_it = std::find_if(regions.begin(), regions.end(), - [&](Gocad::Region const& r) { return r.name == *it; }); + [&](Region const& r) { return r.name == *it; }); if (region_it != regions.end()) { l.regions.push_back(*region_it); diff --git a/Applications/FileIO/GocadIO/Layer.h b/Applications/FileIO/GocadIO/Layer.h index 7f09ccadb4fd8ab3eeaf7be5db6610122e840954..dc8565f9ee241d35163935f2d134db9e8fb5db2d 100644 --- a/Applications/FileIO/GocadIO/Layer.h +++ b/Applications/FileIO/GocadIO/Layer.h @@ -32,8 +32,7 @@ struct Layer final std::ostream& operator<<(std::ostream& os, Layer const& l); -Layer parseLayer(std::string const& line, - std::vector<Gocad::Region> const& regions); +Layer parseLayer(std::string const& line, std::vector<Region> const& regions); } // end namespace Gocad } // end namespace FileIO diff --git a/GeoLib/AnalyticalGeometry.h b/GeoLib/AnalyticalGeometry.h index d4fbccd257318849b98ecc035194402cfa46099c..982531a6d392ee21e80f2afe073bfab8fb460470 100644 --- a/GeoLib/AnalyticalGeometry.h +++ b/GeoLib/AnalyticalGeometry.h @@ -125,7 +125,7 @@ void rotatePoints(Eigen::Matrix3d const& rot_mat, std::vector<P*> const& pnts); * Points are rotated using a rotation matrix computed from the first three points * in the vector. Point coordinates are modified as a result of the rotation. */ -Eigen::Matrix3d rotatePointsToXY(std::vector<GeoLib::Point*>& pnts); +Eigen::Matrix3d rotatePointsToXY(std::vector<Point*>& pnts); /** * rotate points to X-Y plane @@ -150,10 +150,10 @@ Eigen::Matrix3d rotatePointsToXY(InputIterator1 p_pnts_begin, * @param intersection_pnt the intersection point if the segments intersect * @return true, if the polyline contains intersections */ -bool lineSegmentsIntersect(const GeoLib::Polyline* ply, - GeoLib::Polyline::SegmentIterator& seg_it0, - GeoLib::Polyline::SegmentIterator& seg_it1, - GeoLib::Point& intersection_pnt); +bool lineSegmentsIntersect(const Polyline* ply, + Polyline::SegmentIterator& seg_it0, + Polyline::SegmentIterator& seg_it1, + Point& intersection_pnt); /** * Check if the two vectors \f$v, w \in R^3\f$ are in parallel @@ -171,8 +171,8 @@ bool parallel(Eigen::Vector3d v, Eigen::Vector3d w); * @param s the intersection point if the segments do intersect * @return true, if the line segments intersect, else false */ -bool lineSegmentIntersect(GeoLib::LineSegment const& s0, - GeoLib::LineSegment const& s1, GeoLib::Point& s); +bool lineSegmentIntersect(LineSegment const& s0, LineSegment const& s1, + Point& s); /// A line segment is given by its two end-points. The function checks, /// if the two line segments (ab) and (cd) intersects. This method checks the @@ -184,26 +184,26 @@ bool lineSegmentIntersect(GeoLib::LineSegment const& s0, /// vector containing two points describing the line segment the original line /// segments are interfering. std::vector<MathLib::Point3d> lineSegmentIntersect2d( - GeoLib::LineSegment const& ab, GeoLib::LineSegment const& cd); + LineSegment const& ab, LineSegment const& cd); /** * Calculates the intersection points of a line PQ and a triangle ABC. * This method requires ABC to be counterclockwise and PQ to point downward. * @return Intersection point or nullptr if there is no intersection. */ -std::unique_ptr<GeoLib::Point> triangleLineIntersection( +std::unique_ptr<Point> triangleLineIntersection( MathLib::Point3d const& a, MathLib::Point3d const& b, MathLib::Point3d const& c, MathLib::Point3d const& p, MathLib::Point3d const& q); /** - * Method first computes the intersection points of line segments of GeoLib::Polyline objects - * (@see computeIntersectionPoints()) and pushes each intersection point in the GeoLib::PointVec + * Method first computes the intersection points of line segments of Polyline objects + * (@see computeIntersectionPoints()) and pushes each intersection point in the PointVec * pnt_vec. For each intersection an id is returned. This id is used to split the two * intersecting straight line segments in four straight line segments. */ -void computeAndInsertAllIntersectionPoints(GeoLib::PointVec &pnt_vec, - std::vector<GeoLib::Polyline*> & plys); +void computeAndInsertAllIntersectionPoints(PointVec &pnt_vec, + std::vector<Polyline*> & plys); /** * Function rotates a polygon to the xy plane. For this reason, (1) the points of @@ -216,7 +216,7 @@ void computeAndInsertAllIntersectionPoints(GeoLib::PointVec &pnt_vec, * @param plane_normal the normal of the original Newell plane * @return a rotated polygon */ -GeoLib::Polygon rotatePolygonToXY(GeoLib::Polygon const& polygon_in, +Polygon rotatePolygonToXY(Polygon const& polygon_in, Eigen::Vector3d& plane_normal); /// Sorts the vector of segments such that the \f$i\f$-th segment is connected @@ -226,7 +226,7 @@ GeoLib::Polygon rotatePolygonToXY(GeoLib::Polygon const& polygon_in, /// connectable. In order to obtain a unique result the segments are sorted such /// that the begin point of the first segment is \c seg_beg_pnt. void sortSegments(MathLib::Point3d const& seg_beg_pnt, - std::vector<GeoLib::LineSegment>& sub_segments); + std::vector<LineSegment>& sub_segments); } // end namespace GeoLib diff --git a/MathLib/LinAlg/Eigen/EigenTools.h b/MathLib/LinAlg/Eigen/EigenTools.h index c3c3b2bd98626d60cc2539729ca5ba750f25b4fd..73bb466904ccfbd61e1945ee58b8d171b61a917b 100644 --- a/MathLib/LinAlg/Eigen/EigenTools.h +++ b/MathLib/LinAlg/Eigen/EigenTools.h @@ -34,15 +34,4 @@ void applyKnownSolution(EigenMatrix &A, EigenVector &b, EigenVector &/*x*/, const std::vector<EigenMatrix::IndexType> &vec_knownX_id, const std::vector<double> &vec_knownX_x, double penalty_scaling = 1e+10); -inline void applyKnownSolution( - Eigen::MatrixXd const& A, Eigen::VectorXd const& b, Eigen::VectorXd& /*x*/, - const std::vector<Eigen::MatrixXd::Index>& _vec_knownX_id, - const std::vector<double>& _vec_knownX_x, double penalty_scaling = 1e+10) -{ - (void) A; (void) b; (void) _vec_knownX_id; (void) _vec_knownX_x; - (void) penalty_scaling; - - OGS_FATAL("Method not implemented."); // TODO implement -} - } // namespace MathLib diff --git a/MeshLib/Elements/MapBulkElementPoint.cpp b/MeshLib/Elements/MapBulkElementPoint.cpp index d2039ee084fb86c1355c4d72aca10b8d10d6fc09..3d170a3b0e87a2d474983defd581168b2df7a910 100644 --- a/MeshLib/Elements/MapBulkElementPoint.cpp +++ b/MeshLib/Elements/MapBulkElementPoint.cpp @@ -14,7 +14,7 @@ namespace MeshLib { -MathLib::Point3d getBulkElementPoint(MeshLib::Tri const& /*tri*/, +MathLib::Point3d getBulkElementPoint(Tri const& /*tri*/, std::size_t const face_id, MathLib::WeightedPoint1D const& wp) { @@ -33,7 +33,7 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Tri const& /*tri*/, } } -MathLib::Point3d getBulkElementPoint(MeshLib::Quad const& /*quad*/, +MathLib::Point3d getBulkElementPoint(Quad const& /*quad*/, std::size_t const face_id, MathLib::WeightedPoint1D const& wp) { @@ -54,7 +54,7 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Quad const& /*quad*/, } } -MathLib::Point3d getBulkElementPoint(MeshLib::Hex const& /*hex*/, +MathLib::Point3d getBulkElementPoint(Hex const& /*hex*/, std::size_t const face_id, MathLib::WeightedPoint2D const& wp) { @@ -81,7 +81,7 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Hex const& /*hex*/, } } -MathLib::Point3d getBulkElementPoint(MeshLib::Prism const& /*prism*/, +MathLib::Point3d getBulkElementPoint(Prism const& /*prism*/, std::size_t const face_id, MathLib::WeightedPoint2D const& wp) { @@ -106,7 +106,7 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Prism const& /*prism*/, } } -MathLib::Point3d getBulkElementPoint(MeshLib::Pyramid const& /*pyramid*/, +MathLib::Point3d getBulkElementPoint(Pyramid const& /*pyramid*/, std::size_t const face_id, MathLib::WeightedPoint2D const& wp) { @@ -132,7 +132,7 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Pyramid const& /*pyramid*/, } } -MathLib::Point3d getBulkElementPoint(MeshLib::Tet const& /*tet*/, +MathLib::Point3d getBulkElementPoint(Tet const& /*tet*/, std::size_t const face_id, MathLib::WeightedPoint2D const& wp) { @@ -152,60 +152,58 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Tet const& /*tet*/, } } -MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh, +MathLib::Point3d getBulkElementPoint(Mesh const& mesh, std::size_t const bulk_element_id, std::size_t const bulk_face_id, MathLib::WeightedPoint1D const& wp) { auto const* element = mesh.getElement(bulk_element_id); - if (element->getCellType() == MeshLib::CellType::QUAD4) + if (element->getCellType() == CellType::QUAD4) { - MeshLib::Quad const& quad(*dynamic_cast<MeshLib::Quad const*>(element)); + Quad const& quad(*dynamic_cast<Quad const*>(element)); return getBulkElementPoint(quad, bulk_face_id, wp); } - if (element->getCellType() == MeshLib::CellType::TRI3) + if (element->getCellType() == CellType::TRI3) { - MeshLib::Tri const& tri = *static_cast<MeshLib::Tri const*>(element); + Tri const& tri = *static_cast<Tri const*>(element); return getBulkElementPoint(tri, bulk_face_id, wp); } OGS_FATAL("Wrong cell type '{:s}' or functionality not yet implemented.", - MeshLib::CellType2String(element->getCellType())); + CellType2String(element->getCellType())); } -MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh, +MathLib::Point3d getBulkElementPoint(Mesh const& mesh, std::size_t bulk_element_id, std::size_t bulk_face_id, MathLib::WeightedPoint2D const& wp) { auto const* element = mesh.getElement(bulk_element_id); - if (element->getCellType() == MeshLib::CellType::HEX8) + if (element->getCellType() == CellType::HEX8) { - MeshLib::Hex const& hex = *static_cast<MeshLib::Hex const*>(element); + Hex const& hex = *static_cast<Hex const*>(element); return getBulkElementPoint(hex, bulk_face_id, wp); } - if (element->getCellType() == MeshLib::CellType::PRISM6) + if (element->getCellType() == CellType::PRISM6) { - MeshLib::Prism const& prism = - *static_cast<MeshLib::Prism const*>(element); + Prism const& prism = *static_cast<Prism const*>(element); return getBulkElementPoint(prism, bulk_face_id, wp); } - if (element->getCellType() == MeshLib::CellType::PYRAMID5) + if (element->getCellType() == CellType::PYRAMID5) { - MeshLib::Pyramid const& pyramid = - *static_cast<MeshLib::Pyramid const*>(element); + Pyramid const& pyramid = *static_cast<Pyramid const*>(element); return getBulkElementPoint(pyramid, bulk_face_id, wp); } - if (element->getCellType() == MeshLib::CellType::TET4) + if (element->getCellType() == CellType::TET4) { - MeshLib::Tet const& tet = *static_cast<MeshLib::Tet const*>(element); + Tet const& tet = *static_cast<Tet const*>(element); return getBulkElementPoint(tet, bulk_face_id, wp); } OGS_FATAL("Wrong cell type '{:s}' or functionality not yet implemented.", - MeshLib::CellType2String(element->getCellType())); + CellType2String(element->getCellType())); } // TODO disable the 3d elements in the local assembler creator -MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& /*mesh*/, +MathLib::Point3d getBulkElementPoint(Mesh const& /*mesh*/, std::size_t /*bulk_element_id*/, std::size_t /*bulk_face_id*/, MathLib::WeightedPoint3D const& /*wp*/) diff --git a/MeshLib/Elements/MapBulkElementPoint.h b/MeshLib/Elements/MapBulkElementPoint.h index 15e08113a5b444aea0628be354d9f7d309c85105..7bb7df08314c1dc716f2fd6295f27999f602651e 100644 --- a/MeshLib/Elements/MapBulkElementPoint.h +++ b/MeshLib/Elements/MapBulkElementPoint.h @@ -30,7 +30,7 @@ namespace MeshLib /// \param face_id the id of the triangle face the point will be mapped on /// \param wp the integration point of the lower dimensional element /// \return the mapped point -MathLib::Point3d getBulkElementPoint(MeshLib::Tri const& tri, +MathLib::Point3d getBulkElementPoint(Tri const& tri, std::size_t const face_id, MathLib::WeightedPoint1D const& wp); @@ -42,42 +42,42 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Tri const& tri, /// \param face_id the id of the quad face the point will be mapped on /// \param wp the integration point of the lower dimensional element /// \return the mapped point -MathLib::Point3d getBulkElementPoint(MeshLib::Quad const& quad, +MathLib::Point3d getBulkElementPoint(Quad const& quad, std::size_t const face_id, MathLib::WeightedPoint1D const& wp); /// Maps the given 2d boundary point \c wp of a quad face, given in local /// coordinates of the quad, to 3d point existing on a hexahedron face also in /// local coordinates. -MathLib::Point3d getBulkElementPoint(MeshLib::Hex const& hex, +MathLib::Point3d getBulkElementPoint(Hex const& hex, std::size_t const face_id, MathLib::WeightedPoint2D const& wp); /// Maps the given lower dimensional 2d boundary point \c wp of a quad or /// triangle element, given in local coordinates of the quad or triangle, to a /// 3d point existing on a tet face also in local coordinates. -MathLib::Point3d getBulkElementPoint(MeshLib::Tet const& tet, +MathLib::Point3d getBulkElementPoint(Tet const& tet, std::size_t const face_id, MathLib::WeightedPoint2D const& wp); /// Maps the given lower dimensional 2d boundary point \c wp of a quad or /// triangle element, given in local coordinates of the quad or triangle, to a /// 3d point existing on a prism face also in local coordinates. -MathLib::Point3d getBulkElementPoint(MeshLib::Prism const& prism, +MathLib::Point3d getBulkElementPoint(Prism const& prism, std::size_t const face_id, MathLib::WeightedPoint2D const& wp); /// Maps the given lower dimensional 2d boundary point \c wp of a quad or /// triangle element, given in local coordinates of the quad or triangle, to a /// 3d point existing on a pyramid face also in local coordinates. -MathLib::Point3d getBulkElementPoint(MeshLib::Pyramid const& pyramid, +MathLib::Point3d getBulkElementPoint(Pyramid const& pyramid, std::size_t const face_id, MathLib::WeightedPoint2D const& wp); /// Maps the given 1d boundary point \c wp of a boundary element, given in local /// coordinates of the boundary element, to 3d point existing on a bulk element /// also in local coordinates. -MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh, +MathLib::Point3d getBulkElementPoint(Mesh const& mesh, std::size_t const bulk_element_id, std::size_t const bulk_face_id, MathLib::WeightedPoint1D const& wp); @@ -85,13 +85,13 @@ MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh, /// Maps the given 2d boundary point \c wp of a boundary element, given in local /// coordinates of the boundary element, to 3d point existing on a bulk element /// also in local coordinates. -MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh, +MathLib::Point3d getBulkElementPoint(Mesh const& mesh, std::size_t bulk_element_id, std::size_t bulk_face_id, MathLib::WeightedPoint2D const& wp); // TODO disable the 3d elements in the local assembler creator -MathLib::Point3d getBulkElementPoint(MeshLib::Mesh const& mesh, +MathLib::Point3d getBulkElementPoint(Mesh const& mesh, std::size_t bulk_element_id, std::size_t bulk_face_id, MathLib::WeightedPoint3D const& wp); diff --git a/MeshLib/IO/XDMF/XdmfData.h b/MeshLib/IO/XDMF/XdmfData.h index 6bb86b6aa09a31a2022f9d80695bf7cb8590eecb..680f53e94b51ae003ebad6b881f6d5d9a9a56326 100644 --- a/MeshLib/IO/XDMF/XdmfData.h +++ b/MeshLib/IO/XDMF/XdmfData.h @@ -38,6 +38,7 @@ struct XdmfData * @param size_tuple We assume there is at most a rank of 2 of data * (properties). The size of tuple gives the length of the second dimension * (index 1). + * @param mesh_property_data_type property vector data type. * @param name The name of the attribute. It assumed to be unique. * @param attribute_center XdmfData is used for topology, geometry and * attributes. Geometry and topology have never a attribute_center. diff --git a/MeshLib/IO/XDMF/transformData.h b/MeshLib/IO/XDMF/transformData.h index 16babbce8775066fdb81ea6703dd4947b704529f..0484e2a801adb1bed016b24c5daa3cb591550844 100644 --- a/MeshLib/IO/XDMF/transformData.h +++ b/MeshLib/IO/XDMF/transformData.h @@ -38,7 +38,9 @@ Geometry transformGeometry(MeshLib::Mesh const& mesh); * The topology is specific to xdmf because it contains the xdmf cell types!! * See section topology in https://www.xdmf.org/index.php/XDMF_Model_and_Format * @param mesh OGS mesh can be mesh or partitionedMesh + * @param offset Local offset to transform local to global cell ID. Offset must + * be zero in serial and must be defined for each process in parallel execution. * @return Topology containing a copy of the data and the topology meta data */ Topology transformTopology(MeshLib::Mesh const& mesh, std::size_t offset); -} // namespace MeshLib::IO \ No newline at end of file +} // namespace MeshLib::IO diff --git a/MeshLib/Mesh.h b/MeshLib/Mesh.h index 3cae4d3ef4bcede5e30dc811dd036b052b4e3351..2056afbe4da47a237df3195a92b3a233c3d26606 100644 --- a/MeshLib/Mesh.h +++ b/MeshLib/Mesh.h @@ -40,7 +40,8 @@ namespace MeshLib class Mesh { /* friend functions: */ - friend void removeMeshNodes(MeshLib::Mesh &mesh, const std::vector<std::size_t> &nodes); + friend void removeMeshNodes(Mesh& mesh, + const std::vector<std::size_t>& nodes); friend class ApplicationUtils::NodeWiseMeshPartitioner; @@ -127,8 +128,8 @@ public: /// Return true if the mesh has any nonlinear nodes bool isNonlinear() const { return (getNumberOfNodes() != getNumberOfBaseNodes()); } - MeshLib::Properties & getProperties() { return _properties; } - MeshLib::Properties const& getProperties() const { return _properties; } + Properties& getProperties() { return _properties; } + Properties const& getProperties() const { return _properties; } bool isAxiallySymmetric() const { return _is_axially_symmetric; } void setAxiallySymmetric(bool is_axial_symmetric) { @@ -190,7 +191,7 @@ inline bool operator!=(Mesh const& a, Mesh const& b) /// Scales the mesh property with name \c property_name by given \c factor. /// \note The property must be a "double" property. -void scaleMeshPropertyVector(MeshLib::Mesh& mesh, +void scaleMeshPropertyVector(Mesh& mesh, std::string const& property_name, double factor); @@ -205,12 +206,11 @@ void scaleMeshPropertyVector(MeshLib::Mesh& mesh, /// \param values A vector containing the values that are used for /// initialization. template <typename T> -void addPropertyToMesh(MeshLib::Mesh& mesh, std::string const& name, - MeshLib::MeshItemType item_type, - std::size_t number_of_components, +void addPropertyToMesh(Mesh& mesh, std::string const& name, + MeshItemType item_type, std::size_t number_of_components, std::vector<T> const& values) { - if (item_type == MeshLib::MeshItemType::Node) + if (item_type == MeshItemType::Node) { if (mesh.getNumberOfNodes() != values.size() / number_of_components) { @@ -220,7 +220,7 @@ void addPropertyToMesh(MeshLib::Mesh& mesh, std::string const& name, mesh.getNumberOfNodes(), values.size() / number_of_components); } } - if (item_type == MeshLib::MeshItemType::Cell) + if (item_type == MeshItemType::Cell) { if (mesh.getNumberOfElements() != values.size() / number_of_components) { @@ -249,7 +249,7 @@ void addPropertyToMesh(MeshLib::Mesh& mesh, std::string const& name, template <typename T> PropertyVector<T>* getOrCreateMeshProperty(Mesh& mesh, std::string const& property_name, - MeshLib::MeshItemType const item_type, + MeshItemType const item_type, int const number_of_components) { if (property_name.empty()) @@ -261,16 +261,16 @@ PropertyVector<T>* getOrCreateMeshProperty(Mesh& mesh, auto numberOfMeshItems = [&mesh, &item_type]() -> std::size_t { switch (item_type) { - case MeshLib::MeshItemType::Cell: + case MeshItemType::Cell: return mesh.getNumberOfElements(); - case MeshLib::MeshItemType::Node: + case MeshItemType::Node: return mesh.getNumberOfNodes(); - case MeshLib::MeshItemType::IntegrationPoint: + case MeshItemType::IntegrationPoint: return 0; // For the integration point data the size is // variable default: OGS_FATAL( - "MeshLib::getOrCreateMeshProperty cannot handle other " + "getOrCreateMeshProperty cannot handle other " "types than Node, Cell, or IntegrationPoint."); } return 0; @@ -309,7 +309,7 @@ PropertyVector<int> const* materialIDs(Mesh const& mesh); /// /// \note The elements are owned by the returned mesh object as well as the /// nodes and will be destructed together with the mesh. -std::unique_ptr<MeshLib::Mesh> createMeshFromElementSelection( - std::string mesh_name, std::vector<MeshLib::Element*> const& elements); +std::unique_ptr<Mesh> createMeshFromElementSelection( + std::string mesh_name, std::vector<Element*> const& elements); } // namespace MeshLib diff --git a/MeshLib/MeshEditing/DuplicateMeshComponents.cpp b/MeshLib/MeshEditing/DuplicateMeshComponents.cpp index 14b4884c450c77aab57171f22a26a8990beb072c..c4b52ab38df4239ee8a1f6db12e44f087139b6cb 100644 --- a/MeshLib/MeshEditing/DuplicateMeshComponents.cpp +++ b/MeshLib/MeshEditing/DuplicateMeshComponents.cpp @@ -19,26 +19,24 @@ namespace MeshLib { -std::vector<MeshLib::Node*> copyNodeVector( - const std::vector<MeshLib::Node*>& nodes) +std::vector<Node*> copyNodeVector(const std::vector<Node*>& nodes) { const std::size_t nNodes(nodes.size()); - std::vector<MeshLib::Node*> new_nodes; + std::vector<Node*> new_nodes; new_nodes.reserve(nNodes); for (std::size_t k = 0; k < nNodes; ++k) { - new_nodes.push_back( - new MeshLib::Node(nodes[k]->getCoords(), new_nodes.size())); + new_nodes.push_back(new Node(nodes[k]->getCoords(), new_nodes.size())); } return new_nodes; } -std::vector<MeshLib::Element*> copyElementVector( - std::vector<MeshLib::Element*> const& elements, - std::vector<MeshLib::Node*> const& new_nodes, +std::vector<Element*> copyElementVector( + std::vector<Element*> const& elements, + std::vector<Node*> const& new_nodes, std::vector<std::size_t> const* const node_id_map) { - std::vector<MeshLib::Element*> new_elements; + std::vector<Element*> new_elements; new_elements.reserve(elements.size()); std::transform(elements.begin(), elements.end(), std::back_inserter(new_elements), @@ -51,12 +49,12 @@ std::vector<MeshLib::Element*> copyElementVector( /// Copies an element without change, using the nodes vector from the result /// mesh. template <typename E> -MeshLib::Element* copyElement(MeshLib::Element const* const element, - const std::vector<MeshLib::Node*>& nodes, - std::vector<std::size_t> const* const id_map) +Element* copyElement(Element const* const element, + const std::vector<Node*>& nodes, + std::vector<std::size_t> const* const id_map) { unsigned const number_of_element_nodes(element->getNumberOfNodes()); - auto** new_nodes = new MeshLib::Node*[number_of_element_nodes]; + auto** new_nodes = new Node*[number_of_element_nodes]; if (id_map) { for (unsigned i = 0; i < number_of_element_nodes; ++i) @@ -74,42 +72,42 @@ MeshLib::Element* copyElement(MeshLib::Element const* const element, return new E(new_nodes); } -MeshLib::Element* copyElement(MeshLib::Element const* const element, - const std::vector<MeshLib::Node*>& nodes, - std::vector<std::size_t> const* const id_map) +Element* copyElement(Element const* const element, + const std::vector<Node*>& nodes, + std::vector<std::size_t> const* const id_map) { switch (element->getCellType()) { case CellType::LINE2: - return copyElement<MeshLib::Line>(element, nodes, id_map); + return copyElement<Line>(element, nodes, id_map); case CellType::LINE3: - return copyElement<MeshLib::Line3>(element, nodes, id_map); + return copyElement<Line3>(element, nodes, id_map); case CellType::TRI3: - return copyElement<MeshLib::Tri>(element, nodes, id_map); + return copyElement<Tri>(element, nodes, id_map); case CellType::TRI6: - return copyElement<MeshLib::Tri6>(element, nodes, id_map); + return copyElement<Tri6>(element, nodes, id_map); case CellType::QUAD4: - return copyElement<MeshLib::Quad>(element, nodes, id_map); + return copyElement<Quad>(element, nodes, id_map); case CellType::QUAD8: - return copyElement<MeshLib::Quad8>(element, nodes, id_map); + return copyElement<Quad8>(element, nodes, id_map); case CellType::QUAD9: - return copyElement<MeshLib::Quad9>(element, nodes, id_map); + return copyElement<Quad9>(element, nodes, id_map); case CellType::TET4: - return copyElement<MeshLib::Tet>(element, nodes, id_map); + return copyElement<Tet>(element, nodes, id_map); case CellType::TET10: - return copyElement<MeshLib::Tet10>(element, nodes, id_map); + return copyElement<Tet10>(element, nodes, id_map); case CellType::HEX8: - return copyElement<MeshLib::Hex>(element, nodes, id_map); + return copyElement<Hex>(element, nodes, id_map); case CellType::HEX20: - return copyElement<MeshLib::Hex20>(element, nodes, id_map); + return copyElement<Hex20>(element, nodes, id_map); case CellType::PYRAMID5: - return copyElement<MeshLib::Pyramid>(element, nodes, id_map); + return copyElement<Pyramid>(element, nodes, id_map); case CellType::PYRAMID13: - return copyElement<MeshLib::Pyramid13>(element, nodes, id_map); + return copyElement<Pyramid13>(element, nodes, id_map); case CellType::PRISM6: - return copyElement<MeshLib::Prism>(element, nodes, id_map); + return copyElement<Prism>(element, nodes, id_map); case CellType::PRISM15: - return copyElement<MeshLib::Prism15>(element, nodes, id_map); + return copyElement<Prism15>(element, nodes, id_map); default: { ERR("Error: Unknown cell type."); @@ -118,14 +116,13 @@ MeshLib::Element* copyElement(MeshLib::Element const* const element, } } -std::vector<MeshLib::Element*> cloneElements( - std::vector<MeshLib::Element*> const& elements) +std::vector<Element*> cloneElements(std::vector<Element*> const& elements) { - std::vector<MeshLib::Element*> cloned_elements; + std::vector<Element*> cloned_elements; cloned_elements.reserve(elements.size()); std::transform(begin(elements), end(elements), std::back_inserter(cloned_elements), - [](MeshLib::Element* const e) { return e->clone(); }); + [](Element* const e) { return e->clone(); }); return cloned_elements; } diff --git a/MeshLib/MeshEditing/DuplicateMeshComponents.h b/MeshLib/MeshEditing/DuplicateMeshComponents.h index 4ff925bcc0d4f1fa25be263c129ff92f3bbb80c8..f5765a4ffc274eb20ba3a3a5e40701060f1072e8 100644 --- a/MeshLib/MeshEditing/DuplicateMeshComponents.h +++ b/MeshLib/MeshEditing/DuplicateMeshComponents.h @@ -23,8 +23,7 @@ class Node; class Element; /// Creates a deep copy of a Node vector -std::vector<MeshLib::Node*> copyNodeVector( - const std::vector<MeshLib::Node*>& nodes); +std::vector<Node*> copyNodeVector(const std::vector<Node*>& nodes); /** Creates a deep copy of an element vector using the given Node vector. * @param elements The element vector that should be duplicated. @@ -34,19 +33,17 @@ std::vector<MeshLib::Node*> copyNodeVector( * vector. * @return A deep copy of the elements vector using the new nodes vector. */ -std::vector<MeshLib::Element*> copyElementVector( - std::vector<MeshLib::Element*> const& elements, - std::vector<MeshLib::Node*> const& new_nodes, +std::vector<Element*> copyElementVector( + std::vector<Element*> const& elements, + std::vector<Node*> const& new_nodes, std::vector<std::size_t> const* const node_id_map = nullptr); /// Copies an element without change, using the nodes vector from the result /// mesh and an optional mapping from the nodes the 'old' elements. -MeshLib::Element* copyElement( - MeshLib::Element const* const element, - const std::vector<MeshLib::Node*>& nodes, - std::vector<std::size_t> const* const id_map = nullptr); +Element* copyElement(Element const* const element, + const std::vector<Node*>& nodes, + std::vector<std::size_t> const* const id_map = nullptr); /// Clones a vector of elements using the Element::clone() function. -std::vector<MeshLib::Element*> cloneElements( - std::vector<MeshLib::Element*> const& elements); +std::vector<Element*> cloneElements(std::vector<Element*> const& elements); } // end namespace MeshLib diff --git a/MeshLib/MeshEditing/FlipElements.cpp b/MeshLib/MeshEditing/FlipElements.cpp index 59cf46ee38ed8fefc19ff423f22be0034a98d72d..97a48188ff4ca74602b57f0e6528960a8a1a7fe8 100644 --- a/MeshLib/MeshEditing/FlipElements.cpp +++ b/MeshLib/MeshEditing/FlipElements.cpp @@ -19,8 +19,8 @@ namespace MeshLib { -std::unique_ptr<MeshLib::Element> createFlippedElement( - MeshLib::Element const& elem, std::vector<MeshLib::Node*> const& nodes) +std::unique_ptr<Element> createFlippedElement(Element const& elem, + std::vector<Node*> const& nodes) { if (elem.getDimension() > 2) { @@ -28,7 +28,7 @@ std::unique_ptr<MeshLib::Element> createFlippedElement( } unsigned const n_nodes(elem.getNumberOfNodes()); - auto elem_nodes = std::make_unique<MeshLib::Node*[]>(n_nodes); + auto elem_nodes = std::make_unique<Node*[]>(n_nodes); for (unsigned i = 0; i < n_nodes; ++i) { elem_nodes[i] = nodes[elem.getNode(i)->getID()]; @@ -37,34 +37,30 @@ std::unique_ptr<MeshLib::Element> createFlippedElement( if (elem.getGeomType() == MeshElemType::LINE) { - return std::make_unique<MeshLib::Line>(elem_nodes.release(), - elem.getID()); + return std::make_unique<Line>(elem_nodes.release(), elem.getID()); } if (elem.getGeomType() == MeshElemType::TRIANGLE) { - return std::make_unique<MeshLib::Tri>(elem_nodes.release(), - elem.getID()); + return std::make_unique<Tri>(elem_nodes.release(), elem.getID()); } if (elem.getGeomType() == MeshElemType::QUAD) { std::swap(elem_nodes[2], elem_nodes[3]); - return std::make_unique<MeshLib::Quad>(elem_nodes.release(), - elem.getID()); + return std::make_unique<Quad>(elem_nodes.release(), elem.getID()); } return nullptr; } -std::unique_ptr<MeshLib::Mesh> createFlippedMesh(MeshLib::Mesh const& mesh) +std::unique_ptr<Mesh> createFlippedMesh(Mesh const& mesh) { if (mesh.getDimension() > 2) { return nullptr; } - std::vector<MeshLib::Node*> new_nodes( - MeshLib::copyNodeVector(mesh.getNodes())); - std::vector<MeshLib::Element*> const& elems(mesh.getElements()); - std::vector<MeshLib::Element*> new_elems; + std::vector<Node*> new_nodes(copyNodeVector(mesh.getNodes())); + std::vector<Element*> const& elems(mesh.getElements()); + std::vector<Element*> new_elems; std::size_t n_elems(mesh.getNumberOfElements()); new_elems.reserve(n_elems); @@ -74,8 +70,8 @@ std::unique_ptr<MeshLib::Mesh> createFlippedMesh(MeshLib::Mesh const& mesh) createFlippedElement(*elems[i], new_nodes).release()); } - return std::make_unique<MeshLib::Mesh>("FlippedElementMesh", new_nodes, - new_elems, mesh.getProperties()); + return std::make_unique<Mesh>("FlippedElementMesh", new_nodes, new_elems, + mesh.getProperties()); } } // end namespace MeshLib diff --git a/MeshLib/MeshEditing/FlipElements.h b/MeshLib/MeshEditing/FlipElements.h index 80a122c031dcf809a115d1e9141d0ba95033c1db..df4f30fcacf51dcd0d0ac31518b9791ea45702be 100644 --- a/MeshLib/MeshEditing/FlipElements.h +++ b/MeshLib/MeshEditing/FlipElements.h @@ -27,8 +27,8 @@ class Node; * @param nodes node vector used for the copy of the element * @return a flipped copy of the element */ -std::unique_ptr<MeshLib::Element> createFlippedElement( - MeshLib::Element const& elem, std::vector<MeshLib::Node*> const& nodes); +std::unique_ptr<Element> createFlippedElement(Element const& elem, + std::vector<Node*> const& nodes); /** * Creates a copy of a 1d / 2d mesh where the node order of all elements @@ -37,6 +37,6 @@ std::unique_ptr<MeshLib::Element> createFlippedElement( * @param mesh input mesh * @return a flipped copy of the input mesh */ -std::unique_ptr<MeshLib::Mesh> createFlippedMesh(MeshLib::Mesh const& mesh); +std::unique_ptr<Mesh> createFlippedMesh(Mesh const& mesh); } // namespace MeshLib diff --git a/MeshLib/MeshEditing/ProjectPointOnMesh.cpp b/MeshLib/MeshEditing/ProjectPointOnMesh.cpp index 88930006e5858debe69454c5bdd90ce73414dcf0..99a446022d5be45b98e526db3a48bb77c6feb54e 100644 --- a/MeshLib/MeshEditing/ProjectPointOnMesh.cpp +++ b/MeshLib/MeshEditing/ProjectPointOnMesh.cpp @@ -18,11 +18,10 @@ namespace MeshLib { namespace ProjectPointOnMesh { -MeshLib::Element const* getProjectedElement( - std::vector<const MeshLib::Element*> const& elements, - MeshLib::Node const& node) +Element const* getProjectedElement(std::vector<const Element*> const& elements, + Node const& node) { - auto is_right_of = [&node](MeshLib::Node const& a, MeshLib::Node const& b) { + auto is_right_of = [&node](Node const& a, Node const& b) { return GeoLib::getOrientationFast(node, a, b) == GeoLib::Orientation::CW; }; @@ -30,7 +29,7 @@ MeshLib::Element const* getProjectedElement( for (auto const* e : elements) { auto const* nodes = e->getNodes(); - if (e->getGeomType() == MeshLib::MeshElemType::TRIANGLE) + if (e->getGeomType() == MeshElemType::TRIANGLE) { auto const& a = *nodes[0]; auto const& b = *nodes[1]; @@ -40,7 +39,7 @@ MeshLib::Element const* getProjectedElement( return e; } } - else if (e->getGeomType() == MeshLib::MeshElemType::QUAD) + else if (e->getGeomType() == MeshElemType::QUAD) { auto const& a = *nodes[0]; auto const& b = *nodes[1]; @@ -56,12 +55,12 @@ MeshLib::Element const* getProjectedElement( return nullptr; } -double getElevation(MeshLib::Element const& element, MeshLib::Node const& node) +double getElevation(Element const& element, Node const& node) { Eigen::Vector3d const v = Eigen::Map<Eigen::Vector3d const>(node.getCoords()) - Eigen::Map<Eigen::Vector3d const>(element.getNode(0)->getCoords()); - auto const n = MeshLib::FaceRule::getSurfaceNormal(&element).normalized(); + auto const n = FaceRule::getSurfaceNormal(&element).normalized(); return node[2] - n.dot(v) * n[2]; } diff --git a/MeshLib/MeshEditing/ProjectPointOnMesh.h b/MeshLib/MeshEditing/ProjectPointOnMesh.h index 962883ba7695b7d10723415455269b985bca394d..f754ca211cc8eba788dc45a49077eb3bc358cf0c 100644 --- a/MeshLib/MeshEditing/ProjectPointOnMesh.h +++ b/MeshLib/MeshEditing/ProjectPointOnMesh.h @@ -21,14 +21,12 @@ namespace ProjectPointOnMesh /// Returns the element in which the given node is located when projected onto a /// mesh, or nullptr if no such element was found. - MeshLib::Element const* getProjectedElement( - std::vector<const MeshLib::Element*> const& elements, - MeshLib::Node const& node); +Element const* getProjectedElement(std::vector<const Element*> const& elements, + Node const& node); /// Returns the z-coordinate of a point projected onto the plane defined by a /// mesh element. -double getElevation(MeshLib::Element const& element, - MeshLib::Node const& node); +double getElevation(Element const& element, Node const& node); } // namespace ProjectPointOnMesh diff --git a/MeshLib/Vtk/VtkMeshNodalCoordinatesTemplate-impl.h b/MeshLib/Vtk/VtkMeshNodalCoordinatesTemplate-impl.h index 5be0cd61a251261634249c415173982dfd43d588..a346f1c70b0ca5d222dba195a5c74fc2c7f048de 100644 --- a/MeshLib/Vtk/VtkMeshNodalCoordinatesTemplate-impl.h +++ b/MeshLib/Vtk/VtkMeshNodalCoordinatesTemplate-impl.h @@ -12,8 +12,6 @@ * */ -#include "VtkMeshNodalCoordinatesTemplate.h" - #include <vtkIdList.h> #include <vtkObjectFactory.h> #include <vtkVariant.h> @@ -52,8 +50,9 @@ template <class Scalar> void VtkMeshNodalCoordinatesTemplate<Scalar> this->NumberOfComponents = 1; } -template <class Scalar> void VtkMeshNodalCoordinatesTemplate<Scalar> -::SetNodes(std::vector<MeshLib::Node*> const & nodes) +template <class Scalar> +void VtkMeshNodalCoordinatesTemplate<Scalar>::SetNodes( + std::vector<Node*> const& nodes) { Initialize(); _nodes = &nodes; diff --git a/MeshLib/Vtk/VtkMeshNodalCoordinatesTemplate.h b/MeshLib/Vtk/VtkMeshNodalCoordinatesTemplate.h index cda499ac1999658569689bacd0090c13c36d5e64..5b946ad65ff78a5638da20c13a96593a7f7a336f 100644 --- a/MeshLib/Vtk/VtkMeshNodalCoordinatesTemplate.h +++ b/MeshLib/Vtk/VtkMeshNodalCoordinatesTemplate.h @@ -38,7 +38,7 @@ public: using ValueType = typename Superclass::ValueType; /// Pass the nodes from OGS mesh - void SetNodes(std::vector<MeshLib::Node*> const& nodes); + void SetNodes(std::vector<Node*> const& nodes); // Reimplemented virtuals -- see superclasses for descriptions void Initialize() override; @@ -108,7 +108,7 @@ protected: VtkMeshNodalCoordinatesTemplate(); ~VtkMeshNodalCoordinatesTemplate() override; - const std::vector<MeshLib::Node*>* _nodes{nullptr}; + const std::vector<Node*>* _nodes{nullptr}; private: vtkIdType Lookup(const Scalar& val, vtkIdType startIndex); diff --git a/ParameterLib/FunctionParameter.h b/ParameterLib/FunctionParameter.h index 69d1e0c9428d341a206939bb1d53773123ee9458..f05c35d1b11f5d840d159dbb834860e6b139a317 100644 --- a/ParameterLib/FunctionParameter.h +++ b/ParameterLib/FunctionParameter.h @@ -55,6 +55,7 @@ struct FunctionParameter final : public Parameter<T> * * @param name the parameter's name * @param vec_expression_str a vector of mathematical expressions + * @param curves named list of curves used by expressions. * The vector size specifies the number of components of the parameter. */ FunctionParameter(