31 Mesh const& src_mesh, std::string
const& property_name)
32 : _src_mesh(src_mesh), _property_name(property_name)
40 ERR(
"MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh() "
41 "dimension of source (dim = {:d}) and destination (dim = {:d}) "
42 "mesh does not match.",
50 "MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh() "
51 "implemented only for 2D case at the moment.");
63 INFO(
"Create new PropertyVector '{:s}' of type double.",
71 "Could not get or create a PropertyVector of type double using "
72 "the given name '{:s}'.",
88 Mesh const& dest_mesh,
91 std::vector<double> interpolated_src_node_properties(
94 interpolated_src_node_properties);
103 auto const& dest_elements(dest_mesh.
getElements());
104 const std::size_t n_dest_elements(dest_elements.size());
105 for (std::size_t k(0); k < n_dest_elements; k++)
119 std::vector<std::vector<MeshLib::Node*>
const*>
const nodes =
124 double average_value(0.0);
126 for (
auto const* nodes_vec : nodes)
128 for (
auto const* node : *nodes_vec)
134 interpolated_src_node_properties[node->getID()];
143 "Mesh2MeshInterpolation: Could not find values in source mesh "
144 "for the element {:d}.",
147 dest_properties[k] = average_value / cnt;
153 std::vector<double>& interpolated_properties)
const
161 auto const* elem_props =
165 const std::size_t n_src_nodes(src_nodes.size());
166 for (std::size_t k(0); k < n_src_nodes; k++)
168 const std::size_t n_con_elems(
170 interpolated_properties[k] = (*elem_props)
172 for (std::size_t j(1); j < n_con_elems; j++)
174 interpolated_properties[k] +=
179 interpolated_properties[k] /= n_con_elems;
Definition of the AABB class.
Definition of the Element class.
Definition of the Grid class.
void INFO(char const *fmt, Args const &... args)
void ERR(char const *fmt, Args const &... args)
void WARN(char const *fmt, Args const &... args)
Implementation of the Mesh2MeshPropertyInterpolation class.
Definition of mesh-related Enumerations.
Definition of the Mesh class.
Definition of the Node class.
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Eigen::Vector3d const & getMinPoint() const
Eigen::Vector3d const & getMaxPoint() const
bool containsPointXY(T const &pnt) const
std::vector< std::vector< POINT * > const * > getPntVecsOfGridCellsIntersectingCuboid(Eigen::Vector3d const &min_pnt, Eigen::Vector3d const &max_pnt) const
virtual MeshElemType getGeomType() const =0
virtual Node *const * getNodes() const =0
Get array of element nodes.
virtual unsigned getNumberOfBaseNodes() const =0
std::string const & _property_name
void interpolatePropertiesForMesh(Mesh const &dest_mesh, MeshLib::PropertyVector< double > &dest_properties) const
bool setPropertiesForMesh(Mesh &dest_mesh) const
Mesh2MeshPropertyInterpolation(Mesh const &src_mesh, std::string const &property_name)
void interpolateElementPropertiesToNodeProperties(std::vector< double > &interpolated_properties) const
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
Properties & getProperties()
std::size_t getNumberOfNodes() const
Get the number of nodes.
std::vector< Element const * > const & getElementsConnectedToNode(std::size_t node_id) const
std::size_t getNumberOfElements() const
Get the number of elements.
PropertyVector< T > const * getPropertyVector(std::string const &name) const
bool existsPropertyVector(std::string const &name) const
PropertyVector< T > * createNewPropertyVector(std::string const &name, MeshItemType mesh_item_type, std::size_t n_components=1)
bool isPointInElementXY(MathLib::Point3d const &p, Element const &e)