29 class NodeWiseMeshPartitioner;
44 const std::vector<std::size_t>& nodes);
119 std::size_t node_id)
const;
121 Node const& node)
const;
146 std::numeric_limits<double>::quiet_NaN(),
147 std::numeric_limits<double>::quiet_NaN()};
179 std::string
const& property_name,
192 template <
typename T>
194 MeshItemType item_type, std::size_t number_of_components,
195 std::vector<T>
const& values)
202 "Error number of nodes ({:d}) does not match the number of "
212 "Error number of elements ({:d}) does not match the number of "
215 values.size() / number_of_components);
220 name, item_type, number_of_components);
223 OGS_FATAL(
"Error while creating PropertyVector '{:s}'.",
name);
225 property->reserve(values.size());
226 std::copy(values.cbegin(), values.cend(), std::back_inserter(*property));
233 template <
typename T>
235 std::string
const& property_name,
237 int const number_of_components)
239 if (property_name.empty())
242 "Trying to get or to create a mesh property with empty name.");
245 auto numberOfMeshItems = [&
mesh, &item_type]() -> std::size_t {
257 "getOrCreateMeshProperty cannot handle other "
258 "types than Node, Cell, or IntegrationPoint.");
272 assert(result->size() ==
273 numberOfMeshItems() * number_of_components);
279 property_name, item_type, number_of_components);
281 result->resize(numberOfMeshItems() * number_of_components);
297 std::string mesh_name, std::vector<Element*>
const& elements);
302 std::vector<Element const*>
const& elements_connected_to_node);
Definition of mesh-related Enumerations.
Definition of the class Properties that implements a container of properties.
MeshLib::Mesh const & mesh() const
double getMaxEdgeLength() const
Get the maximum edge length over all elements of the mesh.
bool isAxiallySymmetric() const
std::size_t getNumberOfBaseNodes() const
Get the number of base nodes.
void calcEdgeLengthRange()
Set the minimum and maximum length over the edges of the mesh.
std::vector< std::vector< Element const * > > _elements_connected_to_nodes
void setName(const std::string &name)
Changes the name of the mesh.
Mesh(std::string name, std::vector< Node * > nodes, std::vector< Element * > elements, Properties const &properties=Properties())
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
void addElement(Element *elem)
Add an element to the mesh.
std::pair< double, double > _edge_length
The minimal and maximal edge length over all elements in the mesh.
friend void removeMeshNodes(Mesh &mesh, const std::vector< std::size_t > &nodes)
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
double getMinEdgeLength() const
Get the minimum edge length over all elements of the mesh.
std::size_t getID() const
Get id of the mesh.
void resetNodeIDs()
Resets the IDs of all mesh-nodes to their position in the node vector.
std::vector< Element * > _elements
void setDimension()
Sets the dimension of the mesh.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
const std::string getName() const
Get name of the mesh.
void resetElementIDs()
Resets the IDs of all mesh-elements to their position in the element vector.
void setElementNeighbors()
virtual ~Mesh()
Destructor.
Properties & getProperties()
std::size_t getNumberOfNodes() const
Get the number of nodes.
std::vector< Element const * > const & getElementsConnectedToNode(std::size_t node_id) const
const Element * getElement(std::size_t idx) const
Get the element with the given index.
void setAxiallySymmetric(bool is_axial_symmetric)
std::pair< double, double > _node_distance
The minimal and maximal distance of nodes within an element over all elements in the mesh.
Properties const & getProperties() const
bool hasNonlinearElement() const
Check if the mesh contains any nonlinear element.
const Node * getNode(std::size_t idx) const
Get the node with the given index.
std::size_t getNumberOfElements() const
Get the number of elements.
std::vector< Node * > _nodes
bool _is_axially_symmetric
Property manager on mesh items. Class Properties manages scalar, vector or matrix properties....
bool existsPropertyVector(std::string const &name) const
PropertyVector< T > * createNewPropertyVector(std::string const &name, MeshItemType mesh_item_type, std::size_t n_components=1)
void copy(PETScVector const &x, PETScVector &y)
std::vector< std::vector< Node * > > calculateNodesConnectedByElements(Mesh const &mesh)
PropertyVector< int > const * materialIDs(Mesh const &mesh)
bool operator==(Mesh const &a, Mesh const &b)
Meshes are equal if their id's are equal.
std::unique_ptr< MeshLib::Mesh > createMeshFromElementSelection(std::string mesh_name, std::vector< MeshLib::Element * > const &elements)
bool operator!=(Mesh const &a, Mesh const &b)
void addPropertyToMesh(Mesh &mesh, std::string const &name, MeshItemType item_type, std::size_t number_of_components, std::vector< T > const &values)
bool isBaseNode(Node const &node, std::vector< Element const * > const &elements_connected_to_node)
PropertyVector< T > * getOrCreateMeshProperty(Mesh &mesh, std::string const &property_name, MeshItemType const item_type, int const number_of_components)
void scaleMeshPropertyVector(MeshLib::Mesh &mesh, std::string const &property_name, double factor)