10 #if !defined(KRATOS_GENERATE_NEW_ELEMENTS_MESHER_PROCESS_H_INCLUDED)
11 #define KRATOS_GENERATE_NEW_ELEMENTS_MESHER_PROCESS_H_INCLUDED
81 : mrModelPart(rModelPart),
82 mrRemesh(rRemeshingParameters)
110 std::cout <<
" [ GENERATE NEW ELEMENTS: " << std::endl;
113 std::cout <<
" ModelPart Supplied do not corresponds to the Meshing Domain: (" << mrModelPart.
Name() <<
" != " << mrRemesh.
SubModelPartName <<
")" << std::endl;
120 std::cout <<
" ERROR : no selection of elements performed before building the elements " << std::endl;
145 ModelPart::ElementsContainerType::iterator element_begin = mrModelPart.
ElementsBegin();
146 ModelPart::NodesContainerType::iterator nodes_begin = mrModelPart.
NodesBegin();
164 std::vector<NodeType::Pointer> list_of_element_centers;
165 std::vector<Geometry<NodeType>> list_of_element_vertices;
178 for (
int el = 0;
el < OutNumberOfElements; ++
el)
183 std::vector<int> neighbours(nds);
185 for (
unsigned int i = 0;
i < nds; ++
i)
188 vertices.
push_back(*(nodes_begin + OutElementList[
el * nds +
i] - 1).base());
191 if (vertices.
back().Is(TO_ERASE))
192 std::cout <<
" WARNING:: mesh vertex RELEASED " << vertices.
back().Id() << std::endl;
202 if (vertices.
size() == 3)
205 vertices[1].
X(), vertices[1].
Y(),
206 vertices[2].
X(), vertices[2].
Y(),
209 else if (vertices.
size() == 4)
212 vertices[1].
X(), vertices[1].
Y(), vertices[1].
Z(),
213 vertices[2].
X(), vertices[2].
Y(), vertices[2].
Z(),
214 vertices[3].
X(), vertices[3].
Y(), vertices[3].
Z(),
222 NodeType::Pointer p_center = Kratos::make_intrusive<NodeType>(
id,
xc,
yc, zc);
227 list_of_element_centers.push_back(p_center);
228 list_of_element_vertices.push_back(vertices);
259 if (mrRemesh.
Options.
Is(MesherUtilities::MESH_SMOOTHING))
262 if (mrRemesh.
Options.
Is(MesherUtilities::REFINE))
263 mrRemesh.
Info->CheckGeometricalSmoothing();
265 mrRemesh.
Info->GeometricalSmoothingRequired =
true;
276 DataTransferUtilities.
TransferData(mrModelPart, rReferenceElement, list_of_element_centers, list_of_element_vertices, MeshDataTransferUtilities::ELEMENT_TO_ELEMENT);
283 for (ModelPart::NodesContainerType::iterator in = mrModelPart.
NodesBegin(); in != mrModelPart.
NodesEnd(); ++in)
293 SetElementNeighbours(mrModelPart);
298 std::cout <<
" GENERATE NEW ELEMENTS ]; " << std::endl;
316 std::string
Info()
const override
318 return "GenerateNewElementsMesherProcess";
324 rOStream <<
"GenerateNewElementsMesherProcess";
388 void SetElementNeighbours(
ModelPart &rModelPart)
394 std::cout <<
" [ SET ELEMENT NEIGHBOURS : " << std::endl;
395 std::cout <<
" Initial Faces : " << rModelPart.
Conditions().size() << std::endl;
398 ModelPart::ElementsContainerType::iterator element_begin = rModelPart.
ElementsBegin();
400 const unsigned int nds = element_begin->GetGeometry().size();
419 unsigned int number_of_faces = i_elem->GetGeometry().FacesNumber();
422 nElements.
resize(number_of_faces);
425 for (
unsigned int iface = 0; iface < number_of_faces; ++iface)
428 index = OutElementNeighbourList[Id * nds + iface];
440 nElements(iface) = *(element_begin + index - 1).base();
444 nElements(iface) = *i_elem.base();
454 std::cout <<
" Final Faces : " << facecounter << std::endl;
455 std::cout <<
" SET ELEMENT NEIGHBORS ]; " << std::endl;
505 rOStream << std::endl;
Base class for all Conditions.
Definition: condition.h:59
Base class for all Elements.
Definition: element.h:60
bool Is(Flags const &rOther) const
Definition: flags.h:274
Short class definition.
Definition: generate_new_elements_mesher_process.hpp:57
KRATOS_CLASS_POINTER_DEFINITION(GenerateNewElementsMesherProcess)
Pointer definition of GenerateNewElementsMesherProcess.
GlobalPointersVector< Element > ElementWeakPtrVectorType
Definition: generate_new_elements_mesher_process.hpp:71
void operator()()
Definition: generate_new_elements_mesher_process.hpp:96
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: generate_new_elements_mesher_process.hpp:322
GenerateNewElementsMesherProcess(ModelPart &rModelPart, MesherUtilities::MeshingParameters &rRemeshingParameters, int EchoLevel)
Default constructor.
Definition: generate_new_elements_mesher_process.hpp:78
ModelPart::ElementsContainerType ElementsContainerType
Definition: generate_new_elements_mesher_process.hpp:70
ModelPart::ConditionType ConditionType
Definition: generate_new_elements_mesher_process.hpp:66
std::string Info() const override
Turn back information as a string.
Definition: generate_new_elements_mesher_process.hpp:316
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: generate_new_elements_mesher_process.hpp:105
ConditionType::GeometryType GeometryType
Definition: generate_new_elements_mesher_process.hpp:68
virtual ~GenerateNewElementsMesherProcess()
Destructor.
Definition: generate_new_elements_mesher_process.hpp:88
ModelPart::NodeType NodeType
Definition: generate_new_elements_mesher_process.hpp:65
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: generate_new_elements_mesher_process.hpp:328
ModelPart::PropertiesType PropertiesType
Definition: generate_new_elements_mesher_process.hpp:67
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
Geometry base class.
Definition: geometry.h:71
void push_back(PointPointerType x)
Definition: geometry.h:548
SizeType size() const
Definition: geometry.h:518
PointReferenceType back()
Definition: geometry.h:507
void resize(size_type new_dim) const
Definition: global_pointers_vector.h:366
Short class definition.
Definition: laplacian_smoothing.hpp:71
virtual void SetEchoLevel(int Level)
Definition: laplacian_smoothing.hpp:755
void ApplyMeshSmoothing(ModelPart &rModelPart, std::vector< int > &PreservedElements, const int *pElementsList, const int &NumberOfPoints)
Definition: laplacian_smoothing.hpp:115
Short class definition.
Definition: mesh_data_transfer_utilities.hpp:46
void TransferData(ModelPart &rModelPart, const Element &rReferenceElement, PointPointerVector &list_of_new_centers, std::vector< Geometry< Node > > &list_of_new_vertices, Flags Options)
Definition: mesh_data_transfer_utilities.cpp:30
void CalculateCenterAndSearchRadius(const std::vector< std::vector< double > > &rPointCoordinates, std::vector< double > &rCenter, double &rRadius)
Definition: mesh_data_transfer_utilities.hpp:334
The base class for processes passed to the solution scheme.
Definition: mesher_process.hpp:37
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
MeshType::ElementsContainerType ElementsContainerType
Element container. A vector set of Elements with their Id's as key.
Definition: model_part.h:168
std::string & Name()
Definition: model_part.h:1811
NodeIterator NodesBegin(IndexType ThisIndex=0)
Definition: model_part.h:487
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
This class defines the node.
Definition: node.h:65
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
Refine Mesh Elements Process 2D and 3D.
Definition: select_elements_mesher_process.hpp:47
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: select_elements_mesher_process.hpp:95
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
float radius
Definition: mesh_to_mdpa_converter.py:18
el
Definition: read_stl.py:25
float xc
Definition: rotating_cone.py:77
float yc
Definition: rotating_cone.py:78
integer i
Definition: TensorModule.f:17
int * GetElementNeighbourList()
Definition: mesher_utilities.hpp:180
int * GetElementList()
Definition: mesher_utilities.hpp:178
int & GetNumberOfPoints()
Definition: mesher_utilities.hpp:182
int & GetNumberOfElements()
Definition: mesher_utilities.hpp:183
Definition: mesher_utilities.hpp:631
MeshingInfoParameters::Pointer Info
Definition: mesher_utilities.hpp:681
Flags Options
Definition: mesher_utilities.hpp:645
std::vector< int > PreservedElements
Definition: mesher_utilities.hpp:669
bool MeshElementsSelectedFlag
Definition: mesher_utilities.hpp:662
MeshContainer OutMesh
Definition: mesher_utilities.hpp:675
std::string SubModelPartName
Definition: mesher_utilities.hpp:642
std::vector< int > NodalPreIds
Definition: mesher_utilities.hpp:668
Element const & GetReferenceElement()
Definition: mesher_utilities.hpp:843