10 #if !defined(KRATOS_GENERATE_NEW_CONDITIONS_MESHER_PROCESS_H_INCLUDED )
11 #define KRATOS_GENERATE_NEW_CONDITIONS_MESHER_PROCESS_H_INCLUDED
85 mrRemesh(rRemeshingParameters)
119 std::cout<<
" [ Build Boundary on ModelPart ["<<
mrModelPart.
Name()<<
"] ]"<<std::endl;
127 std::cout<<
" ERROR: BOUNDARY BUILD FAILED ModelPart : ["<<
mrModelPart<<
"] "<<std::endl;
157 std::string
Info()
const override
159 return "GenerateNewConditionsMesherProcess";
165 rOStream <<
"GenerateNewConditionsMesherProcess";
204 if(number_properties<0)
205 KRATOS_ERROR<<
" number of properties is "<<number_properties<<std::endl;
212 for(
auto& i_elem : rModelPart.
Elements())
216 for(
unsigned int j=0;
j<eGeometry.
size(); ++
j)
218 eGeometry[
j].Set(BOUNDARY,
false);
219 if(rModelPart.
Is(FLUID)){
220 eGeometry[
j].Set(FREE_SURFACE,
false);
228 for(
auto i_elem(rElements.begin()); i_elem != rElements.end(); ++i_elem)
266 unsigned int iface=0;
267 for(
auto& i_nelem : nElements)
269 unsigned int NumberNodesInFace = lnofa[iface];
271 if(i_nelem.Id() == i_elem->Id())
274 unsigned int rigid_nodes = 0;
275 unsigned int inlet_nodes = 0;
276 unsigned int free_surface_nodes = 0;
277 for(
unsigned int j=1;
j<=NumberNodesInFace; ++
j)
279 eGeometry[lpofa(
j,iface)].Set(BOUNDARY,
true);
280 if(rModelPart.
Is(FLUID)){
281 if(eGeometry[lpofa(
j,iface)].
Is(RIGID) || eGeometry[lpofa(
j,iface)].
Is(SOLID)){
284 else if(eGeometry[lpofa(
j,iface)].
Is(INLET)){
288 ++free_surface_nodes;
294 if(rModelPart.
Is(FLUID)){
295 if( (free_surface_nodes>0 && (rigid_nodes>0 || inlet_nodes>0)) || (rigid_nodes==0 && inlet_nodes==0) ){
296 for(
unsigned int j=1;
j<=NumberNodesInFace; ++
j)
298 eGeometry[lpofa(
j,iface)].Set(FREE_SURFACE,
true);
304 Condition::Pointer pBoundaryCondition;
305 bool condition_found =
false;
306 bool point_condition =
false;
308 bool inserted =
false;
309 for(
auto i_cond(rTemporaryConditions.begin()); i_cond != rTemporaryConditions.end(); ++i_cond)
313 if( i_cond->IsNot(TO_ERASE) ){
315 if( i_cond->IsNot(CONTACT) ){
317 if( i_cond->Is(NEW_ENTITY) ){
322 for(
unsigned int i=0;
i<cGeometry.
size(); ++
i )
324 if( cGeometry[
i].
Is(TO_ERASE)){
334 if( rPreservedConditions[i_cond->Id()-1] == 0 ){
337 condition_found = MesherUtils.
FindCondition(cGeometry,eGeometry,lpofa,lnofa,iface);
339 if( condition_found ){
341 pBoundaryCondition = (*i_cond.base());
342 rPreservedConditions[i_cond->Id()-1] += 1;
345 point_condition =
true;
354 if( rPreservedConditions[i_cond->Id()-1] < 2 ){
356 condition_found = this->FindNodeInCondition(cGeometry,eGeometry,lpofa,lnofa,iface);
358 if( condition_found ){
360 pBoundaryCondition = (*i_cond.base());
361 rPreservedConditions[i_cond->Id()-1] += 1;
364 point_condition =
true;
372 rPreservedConditions[i_cond->Id()-1] += 1;
377 if(condition_found==
true){
385 if( !point_condition ){
390 Condition::GeometryType::Pointer ConditionVertices;
392 FaceNodes.
reserve(NumberNodesInFace);
394 for(
unsigned int j=1;
j<=NumberNodesInFace; ++
j)
396 FaceNodes.
push_back(eGeometry(lpofa(
j,iface)));
402 Condition::Pointer p_cond;
405 p_cond = pBoundaryCondition->Clone(rConditionId, FaceNodes);
412 MasterElements.
push_back(*i_elem.base());
415 MasterNodes.
push_back(eGeometry(lpofa(0,iface)));
420 std::cout<<
" NOT FOUND CONDITION :: CREATED-> ["<<rConditionId<<
"] (";
421 std::cout<<FaceNodes[0].Id();
422 for(
unsigned int f=1;
f<FaceNodes.
size(); ++
f)
423 std::cout<<
", "<<FaceNodes[
f].Id();
425 std::cout<<
")"<<std::endl;
431 p_cond = rReferenceCondition.
Create(rConditionId, FaceNodes, properties);
434 for(
unsigned int j=0;
j<FaceNodes.
size(); ++
j)
436 FaceNodes[
j].Set(TO_REFINE);
446 MasterElements.
push_back(*i_elem.base());
449 MasterNodes.
push_back(eGeometry(lpofa(0,iface)));
483 bool node_not_preserved =
false;
484 bool condition_not_preserved =
false;
488 for(
unsigned int j=0;
j<cGeometry.
size(); ++
j)
490 if( cGeometry[
j].
Is(TO_ERASE) || cGeometry[
j].
Is(TO_REFINE) )
491 node_not_preserved =
true;
493 if( cGeometry[
j].
Is(ISOLATED) || cGeometry[
j].
IsNot(BOUNDARY) )
494 condition_not_preserved =
true;
497 if( rCondition.
Is(TO_ERASE) )
498 condition_not_preserved =
true;
500 if( rCondition.
Is(BOUNDARY) )
501 condition_not_preserved =
true;
503 if(node_not_preserved ==
true || condition_not_preserved ==
true)
517 rModelPart.
Conditions().push_back(pCondition);
572 if( cGeometry.
size() != lnofa[iface] )
576 if( lnofa[iface] == 2 )
578 if( cGeometry[0].Id() == eGeometry[lpofa(1,iface)].Id() ||
579 cGeometry[1].Id() == eGeometry[lpofa(2,iface)].Id() ||
580 cGeometry[0].Id() == eGeometry[lpofa(2,iface)].Id() ||
581 cGeometry[1].Id() == eGeometry[lpofa(1,iface)].Id() )
593 if( lnofa[iface] == 3 )
595 if( cGeometry[0].Id() == eGeometry[lpofa(1,iface)].Id() ||
596 cGeometry[1].Id() == eGeometry[lpofa(2,iface)].Id() ||
597 cGeometry[2].Id() == eGeometry[lpofa(3,iface)].Id() ||
598 cGeometry[0].Id() == eGeometry[lpofa(3,iface)].Id() ||
599 cGeometry[1].Id() == eGeometry[lpofa(1,iface)].Id() ||
600 cGeometry[2].Id() == eGeometry[lpofa(2,iface)].Id() ||
601 cGeometry[0].Id() == eGeometry[lpofa(2,iface)].Id() ||
602 cGeometry[1].Id() == eGeometry[lpofa(3,iface)].Id() ||
603 cGeometry[2].Id() == eGeometry[lpofa(1,iface)].Id() )
614 if( lnofa[iface] > 3 )
669 rOStream << std::endl;
Short class definition.
Definition: build_model_part_boundary_process.hpp:79
void ResetFreeSurfaceFlag(ModelPart &rModelPart)
Definition: build_model_part_boundary_process.hpp:1113
bool UniqueSkinSearch(ModelPart &rModelPart)
Definition: build_model_part_boundary_process.hpp:601
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_process.hpp:68
void AddConditionToModelPart(ModelPart &rModelPart, Condition::Pointer pCondition) override
Definition: generate_new_conditions_mesher_process.hpp:512
virtual ~GenerateNewConditionsMesherProcess()
Destructor.
Definition: generate_new_conditions_mesher_process.hpp:91
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: generate_new_conditions_mesher_process.hpp:169
bool CheckAcceptedCondition(ModelPart &rModelPart, Condition &rCondition) override
Definition: generate_new_conditions_mesher_process.hpp:479
bool BuildCompositeConditions(ModelPart &rModelPart, ModelPart::ConditionsContainerType &rTemporaryConditions, std::vector< int > &rPreservedConditions, unsigned int &rConditionId) override
Definition: generate_new_conditions_mesher_process.hpp:194
KRATOS_CLASS_POINTER_DEFINITION(GenerateNewConditionsMesherProcess)
Pointer definition of GenerateNewConditionsMesherProcess.
GenerateNewConditionsMesherProcess(ModelPart &rModelPart, MesherUtilities::MeshingParameters &rRemeshingParameters, int EchoLevel)
Default constructor.
Definition: generate_new_conditions_mesher_process.hpp:81
void Execute() override
Execute method is used to execute the Process algorithms.
Definition: generate_new_conditions_mesher_process.hpp:110
void operator()()
Definition: generate_new_conditions_mesher_process.hpp:100
std::string Info() const override
Turn back information as a string.
Definition: generate_new_conditions_mesher_process.hpp:157
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: generate_new_conditions_mesher_process.hpp:163
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
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
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
void push_back(TPointerType x)
Definition: global_pointers_vector.h:322
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
PropertiesType::Pointer pGetProperties(IndexType PropertiesId)
Definition: mesh.h:394
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
MeshType::ConditionsContainerType ConditionsContainerType
Condintions container. A vector set of Conditions with their Id's as key.
Definition: model_part.h:183
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
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
ModelPart & GetParentModelPart()
Definition: model_part.cpp:2124
MeshType & GetMesh(IndexType ThisIndex=0)
Definition: model_part.h:1791
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
#define KRATOS_ERROR
Definition: exception.h:161
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
Condition::WeakPointer ConditionWeakPtrType
Definition: generate_new_conditions_mesher_process.hpp:45
Element::WeakPointer ElementWeakPtrType
Definition: generate_new_conditions_mesher_process.hpp:44
GlobalPointersVector< Node > NodeWeakPtrVectorType
Definition: build_model_part_boundary_process.hpp:59
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
GlobalPointersVector< Condition > ConditionWeakPtrVectorType
Definition: build_model_part_boundary_process.hpp:61
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
Node::WeakPointer NodeWeakPtrType
Definition: generate_new_conditions_mesher_process.hpp:43
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