31 MeshLib::Mesh const& src_mesh, std::string
const& property_name)
32 : _src_mesh(src_mesh), _property_name(property_name)
41 ERR(
"MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh() "
42 "dimension of source (dim = {:d}) and destination (dim = {:d}) "
43 "mesh does not match.",
51 "MeshLib::Mesh2MeshPropertyInterpolation::setPropertiesForMesh() "
52 "implemented only for 2D case at the moment.");
64 INFO(
"Create new PropertyVector '{:s}' of type double.",
72 "Could not get or create a PropertyVector of type double using "
73 "the given name '{:s}'.",
92 std::vector<double> interpolated_src_node_properties(
95 interpolated_src_node_properties);
104 auto const& dest_elements(dest_mesh.
getElements());
105 const std::size_t n_dest_elements(dest_elements.size());
106 for (std::size_t k(0); k < n_dest_elements; k++)
120 std::vector<std::vector<MeshLib::Node*>
const*>
const nodes =
125 double average_value(0.0);
127 for (
auto const* nodes_vec : nodes)
129 for (
auto const* node : *nodes_vec)
135 interpolated_src_node_properties[node->getID()];
144 "Mesh2MeshInterpolation: Could not find values in source mesh "
145 "for the element {:d}.",
148 dest_properties[k] = average_value / cnt;
154 std::vector<double>& interpolated_properties)
const
162 auto const* elem_props =
166 const std::size_t n_src_nodes(src_nodes.size());
167 for (std::size_t k(0); k < n_src_nodes; k++)
169 const std::size_t n_con_elems(
171 interpolated_properties[k] = (*elem_props)
173 for (std::size_t j(1); j < n_con_elems; j++)
175 interpolated_properties[k] +=
180 interpolated_properties[k] /= n_con_elems;
Definition of the AABB class.
Definition of the Element class.
Definition of the Grid class.
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
void WARN(fmt::format_string< Args... > fmt, Args &&... 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 & getMaxPoint() const
Eigen::Vector3d const & getMinPoint() 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 unsigned getNumberOfBaseNodes() const =0
virtual Node *const * getNodes() const =0
Get array of element nodes.
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
std::vector< Element * > const & getElements() const
Get the element-vector for the mesh.
unsigned getDimension() const
Returns the dimension of the mesh (determined by the maximum dimension over all elements).
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.
bool existsPropertyVector(std::string_view name) const
PropertyVector< T > * createNewPropertyVector(std::string_view name, MeshItemType mesh_item_type, std::size_t n_components=1)
PropertyVector< T > const * getPropertyVector(std::string_view name) const
bool isPointInElementXY(MathLib::Point3d const &p, Element const &e)