10 #if !defined(KRATOS_GENERATE_NEW_CONDITIONS_MESHER_FOR_FLUIDS_PROCESS_H_INCLUDED)
11 #define KRATOS_GENERATE_NEW_CONDITIONS_MESHER_FOR_FLUIDS_PROCESS_H_INCLUDED
78 mrRemesh(rRemeshingParameters)
104 bool success =
false;
109 std::cout <<
" [ Build Boundary on ModelPart [" <<
mrModelPart.
Name() <<
"] ]" << std::endl;
115 std::cout <<
" ERROR: BOUNDARY BUILD FAILED ModelPart : [" <<
mrModelPart <<
"] " << std::endl;
143 std::string
Info()
const override
145 return "GenerateNewConditionsMesherForFluidsProcess";
151 rOStream <<
"GenerateNewConditionsMesherForFluidsProcess";
187 std::cout <<
" [ Initial Conditions : " << rModelPart.
Conditions().size() << std::endl;
190 if (!rModelPart.
Elements().size() || (rModelPart.
Is(ACTIVE)))
194 std::cout <<
" [ Final Conditions : " << rModelPart.
Conditions().size() << std::endl;
200 bool any_node_to_erase =
false;
201 for (ModelPart::NodesContainerType::const_iterator in = rModelPart.
NodesBegin(); in != rModelPart.
NodesEnd(); ++in)
205 in->Reset(FREE_SURFACE);
207 if (any_node_to_erase ==
false)
208 if (in->Is(TO_ERASE))
209 any_node_to_erase =
true;
213 unsigned int ConditionId = 1;
222 TemporaryConditions.push_back(*(i_cond.base()));
223 i_cond->SetId(ConditionId);
230 TemporaryConditions.reserve(rModelPart.
Conditions().size());
231 TemporaryConditions.swap(rModelPart.
Conditions());
234 if (any_node_to_erase)
236 for (ModelPart::ConditionsContainerType::iterator i_cond = TemporaryConditions.begin(); i_cond != TemporaryConditions.end(); ++i_cond)
239 for (
unsigned int i = 0;
i < rConditionGeometry.
size();
i++)
241 if (rConditionGeometry[
i].
Is(TO_ERASE))
243 i_cond->Set(TO_ERASE);
248 i_cond->
SetId(ConditionId);
254 for (ModelPart::ConditionsContainerType::iterator i_cond = TemporaryConditions.begin(); i_cond != TemporaryConditions.end(); ++i_cond)
257 i_cond->SetId(ConditionId);
264 std::vector<int> PreservedConditions(TemporaryConditions.size() + 1);
265 std::fill(PreservedConditions.begin(), PreservedConditions.end(), 0);
271 this->
AddOtherConditions(rModelPart, TemporaryConditions, PreservedConditions, ConditionId);
296 for (ModelPart::ElementsContainerType::iterator ie = elements_begin; ie != elements_end; ++ie)
300 for (
unsigned int j = 0;
j < rElementGeometry.
size(); ++
j)
302 rElementGeometry[
j].Reset(BOUNDARY);
307 for (ModelPart::ElementsContainerType::iterator ie = elements_begin; ie != elements_end; ++ie)
347 unsigned int iface = 0;
351 unsigned int NumberNodesInFace = lnofa[iface];
353 if ((ne)->Id() == ie->Id())
357 bool freeSurfaceFace =
false;
358 for (
unsigned int j = 1;
j <= NumberNodesInFace; ++
j)
360 rElementGeometry[lpofa(
j, iface)].Set(BOUNDARY);
361 if (rElementGeometry[lpofa(
j, iface)].
IsNot(RIGID))
363 freeSurfaceFace =
true;
367 if (freeSurfaceFace ==
true)
369 for (
unsigned int j = 1;
j <= NumberNodesInFace;
j++)
371 rElementGeometry[lpofa(
j, iface)].Set(FREE_SURFACE);
375 Condition::Pointer pBoundaryCondition;
376 bool condition_found =
false;
377 bool point_condition =
false;
379 bool inserted =
false;
380 for (ModelPart::ConditionsContainerType::iterator ic = rTemporaryConditions.begin(); ic != rTemporaryConditions.end(); ++ic)
384 if (ic->IsNot(TO_ERASE))
387 if (ic->IsNot(CONTACT))
390 if (ic->Is(NEW_ENTITY))
397 for (
unsigned int i = 0;
i < rConditionGeometry.
size(); ++
i)
399 if (rConditionGeometry[
i].
Is(TO_ERASE))
411 if (rPreservedConditions[ic->Id() - 1] == 0)
415 condition_found = MesherUtils.
FindCondition(rConditionGeometry, rElementGeometry, lpofa, lnofa, iface);
420 pBoundaryCondition = (*(ic.base()));
421 rPreservedConditions[ic->Id() - 1] += 1;
424 point_condition =
true;
433 if (rPreservedConditions[ic->Id() - 1] < 2)
436 condition_found = this->FindNodeInCondition(rConditionGeometry, rElementGeometry, lpofa, lnofa, iface);
441 pBoundaryCondition = (*(ic.base()));
442 rPreservedConditions[ic->Id() - 1] += 1;
445 point_condition =
true;
457 rPreservedConditions[ic->Id() - 1] += 1;
462 if (condition_found ==
true)
470 if (!point_condition)
476 Condition::GeometryType::Pointer ConditionVertices;
478 FaceNodes.
reserve(NumberNodesInFace);
480 for (
unsigned int j = 1;
j <= NumberNodesInFace; ++
j)
482 FaceNodes.
push_back(rElementGeometry(lpofa(
j, iface)));
488 Condition::Pointer p_cond;
492 p_cond = pBoundaryCondition->Clone(rConditionId, FaceNodes);
499 MasterElements.
push_back((*(ie.base())));
500 p_cond->SetValue(MASTER_ELEMENTS, MasterElements);
504 MasterNodes.
push_back(rElementGeometry(lpofa(0, iface)));
505 p_cond->SetValue(MASTER_NODES, MasterNodes);
512 std::cout <<
" NOT FOUND CONDITION :: CREATED-> [" << rConditionId <<
"] (";
513 std::cout << FaceNodes[0].Id();
514 for (
unsigned int f = 1;
f < FaceNodes.
size(); ++
f)
515 std::cout <<
", " << FaceNodes[
f].Id();
517 std::cout <<
")" << std::endl;
523 p_cond = rReferenceCondition.
Create(rConditionId, FaceNodes, properties);
526 for (
unsigned int j = 0;
j < FaceNodes.
size(); ++
j)
528 FaceNodes[
j].Set(TO_REFINE);
538 MasterElements.
push_back((*(ie.base())));
539 p_cond->SetValue(MASTER_ELEMENTS, MasterElements);
543 MasterNodes.
push_back(rElementGeometry(lpofa(0, iface)));
544 p_cond->SetValue(MASTER_NODES, MasterNodes);
579 bool node_not_preserved =
false;
580 bool condition_not_preserved =
false;
584 for (
unsigned int j = 0;
j < rConditionGeometry.
size(); ++
j)
586 if (rConditionGeometry[
j].
Is(TO_ERASE) || rConditionGeometry[
j].
Is(TO_REFINE))
587 node_not_preserved =
true;
589 if (rConditionGeometry[
j].
Is(ISOLATED) || rConditionGeometry[
j].
IsNot(BOUNDARY))
590 condition_not_preserved =
true;
593 if (rCondition.
Is(TO_ERASE))
594 condition_not_preserved =
true;
596 if (rCondition.
Is(BOUNDARY))
597 condition_not_preserved =
true;
599 if (node_not_preserved ==
true || condition_not_preserved ==
true)
615 rModelPart.
Conditions().push_back(pCondition);
664 if (rConditionGeometry.
size() != lnofa[iface])
668 if (lnofa[iface] == 2)
670 if (rConditionGeometry[0].Id() == rElementGeometry[lpofa(1, iface)].Id() ||
671 rConditionGeometry[1].Id() == rElementGeometry[lpofa(2, iface)].Id() ||
672 rConditionGeometry[0].Id() == rElementGeometry[lpofa(2, iface)].Id() ||
673 rConditionGeometry[1].Id() == rElementGeometry[lpofa(1, iface)].Id())
684 if (lnofa[iface] == 3)
686 if (rConditionGeometry[0].Id() == rElementGeometry[lpofa(1, iface)].Id() ||
687 rConditionGeometry[1].Id() == rElementGeometry[lpofa(2, iface)].Id() ||
688 rConditionGeometry[2].Id() == rElementGeometry[lpofa(3, iface)].Id() ||
689 rConditionGeometry[0].Id() == rElementGeometry[lpofa(3, iface)].Id() ||
690 rConditionGeometry[1].Id() == rElementGeometry[lpofa(1, iface)].Id() ||
691 rConditionGeometry[2].Id() == rElementGeometry[lpofa(2, iface)].Id() ||
692 rConditionGeometry[0].Id() == rElementGeometry[lpofa(2, iface)].Id() ||
693 rConditionGeometry[1].Id() == rElementGeometry[lpofa(3, iface)].Id() ||
694 rConditionGeometry[2].Id() == rElementGeometry[lpofa(1, iface)].Id())
704 if (lnofa[iface] > 3)
754 rOStream << std::endl;
Short class definition.
Definition: build_model_part_boundary_process.hpp:79
bool AddOtherConditions(ModelPart &rModelPart, ModelPart::ConditionsContainerType &rTemporaryConditions, std::vector< int > &rPreservedConditions, unsigned int &rConditionId)
Definition: build_model_part_boundary_process.hpp:1027
int mEchoLevel
Definition: build_model_part_boundary_process.hpp:571
ModelPart & mrModelPart
Definition: build_model_part_boundary_process.hpp:567
bool ClearMasterEntities(ModelPart &rModelPart, ModelPart::ConditionsContainerType &rTemporaryConditions)
Definition: build_model_part_boundary_process.hpp:583
Base class for all Conditions.
Definition: condition.h:59
virtual Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const
It creates a new condition pointer.
Definition: condition.h:205
bool Is(Flags const &rOther) const
Definition: flags.h:274
bool IsNot(Flags const &rOther) const
Definition: flags.h:291
Short class definition.
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:61
void AddConditionToModelPart(ModelPart &rModelPart, Condition::Pointer pCondition) override
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:610
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:100
bool UniqueSkinSearch(ModelPart &rModelPart)
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:180
virtual ~GenerateNewConditionsMesherForFluidsProcess()
Destructor.
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:83
KRATOS_CLASS_POINTER_DEFINITION(GenerateNewConditionsMesherForFluidsProcess)
Pointer definition of GenerateNewConditionsMesherForFluidsProcess.
bool BuildCompositeConditions(ModelPart &rModelPart, ModelPart::ConditionsContainerType &rTemporaryConditions, std::vector< int > &rPreservedConditions, unsigned int &rConditionId) override
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:278
void operator()()
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:91
bool CheckAcceptedCondition(ModelPart &rModelPart, Condition &rCondition) override
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:575
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:155
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:149
GenerateNewConditionsMesherForFluidsProcess(ModelPart &rModelPart, MesherUtilities::MeshingParameters &rRemeshingParameters, int EchoLevel)
Default constructor.
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:74
std::string Info() const override
Turn back information as a string.
Definition: generate_new_conditions_mesher_for_fluids_process.hpp:143
GeometryType & GetGeometry()
Returns the reference of the geometry.
Definition: geometrical_object.h:158
Geometry base class.
Definition: geometry.h:71
SizeType PointsNumber() const
Definition: geometry.h:528
void SetId(const IndexType Id)
Sets Id of this Geometry.
Definition: geometry.h:982
SizeType size() const
Definition: geometry.h:518
virtual void NodesInFaces(DenseMatrix< unsigned int > &rNodesInFaces) const
Definition: geometry.h:2195
virtual void NumberNodesInFaces(DenseVector< unsigned int > &rNumberNodesInFaces) const
Definition: geometry.h:2190
virtual SizeType FacesNumber() const
Returns the number of faces of the current geometry.
Definition: geometry.h:2152
SizeType WorkingSpaceDimension() const
Definition: geometry.h:1287
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: global_pointers_vector.h:79
void push_back(TPointerType x)
Definition: global_pointers_vector.h:322
iterator begin()
Definition: global_pointers_vector.h:221
iterator end()
Definition: global_pointers_vector.h:229
Definition: amatrix_interface.h:41
Short class definition.
Definition: mesh_data_transfer_utilities.hpp:46
void InitializeBoundaryData(Condition *rCurrentCondition, const TransferParameters &rTransferVariables, const ProcessInfo &rCurrentProcessInfo)
Definition: mesh_data_transfer_utilities.cpp:65
Short class definition.
Definition: mesher_utilities.hpp:49
bool FindCondition(Geometry< Node > &rConditionGeometry, Geometry< Node > &rGeometry, DenseMatrix< unsigned int > &lpofa, DenseVector< unsigned int > &lnofa, unsigned int &iface)
Definition: mesher_utilities.cpp:1971
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::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
PropertiesType::Pointer pGetProperties(IndexType PropertiesId, IndexType MeshIndex=0)
Returns the Properties::Pointer corresponding to it's identifier.
Definition: model_part.cpp:664
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
SizeType NumberOfProperties(IndexType ThisIndex=0) const
Returns the number of properties of the mesh.
Definition: model_part.cpp:575
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
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
MeshType::NodesContainerType NodesContainerType
Nodes container. Which is a vector set of nodes with their Id's as key.
Definition: model_part.h:128
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
NodeIterator NodesEnd(IndexType ThisIndex=0)
Definition: model_part.h:497
ModelPart & GetParentModelPart()
Definition: model_part.cpp:2124
ConditionIterator ConditionsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1371
PointerVector is a container like stl vector but using a vector to store pointers to its data.
Definition: pointer_vector.h:72
size_type size() const
Definition: pointer_vector.h:255
void reserve(size_type dim)
Definition: pointer_vector.h:319
void push_back(const TPointerType &x)
Definition: pointer_vector.h:270
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
GlobalPointersVector< Element > ElementWeakPtrVectorType
Definition: build_model_part_boundary_process.hpp:60
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
ModelPart::NodesContainerType NodesContainerType
Definition: find_conditions_neighbours_process.h:44
ModelPart::ConditionsContainerType ConditionsContainerType
Definition: find_conditions_neighbours_process.h:45
GlobalPointersVector< Node > NodeWeakPtrVectorType
Definition: build_model_part_boundary_process.hpp:59
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
ModelPart::ElementsContainerType ElementsContainerType
Definition: clear_contact_conditions_mesher_process.hpp:43
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
f
Definition: generate_convection_diffusion_explicit_element.py:112
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
int j
Definition: quadrature.py:648
integer i
Definition: TensorModule.f:17
Definition: mesher_utilities.hpp:631
Condition const & GetReferenceCondition()
Definition: mesher_utilities.hpp:847
TransferParametersType::Pointer Transfer
Definition: mesher_utilities.hpp:690