## create compounds
# create a compound of two meshes with renaming namesake groups and
-# merging of elements with the given tolerance
+# merging elements with the given tolerance
Compound1 = smesh.Concatenate([Mesh_inf, Mesh_sup], 0, 1, 1e-05,
- name='Compound_with_RenamedGrps_and_MergeElems')
+ name='Compound with RenamedGrps and MergeElems')
# create a compound of two meshes with uniting namesake groups and
# creating groups of all elements
Compound2 = smesh.Concatenate([Mesh_inf, Mesh_sup], 1, 0, 1e-05, True,
- name='Compound_with_UniteGrps_and_GrpsOfAllElems')
+ name='Compound with UniteGrps and GrpsOfAllElems')
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(True)
# create a group of elements with area [35; 40] by removing elements with area > 40 from group aGroup
aGroup.Remove(anIds)
+aGroup.SetName("35 < Area < 40")
# print the result
aGroupElemIDs = aGroup.GetListOfID()
# create union group : area >= 20
aGroup3 = mesh.UnionListOfGroups([aGroup1, aGroup2], "Area >= 20")
+aGroup3.SetColor( SALOMEDS.Color(1.,1.,0.));
print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())
# Please note that also there is UnionGroups() method which works with two groups only
# create a group by adding elements with area < 20
aGroup4 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 20")
aGroup4.Add(anIds)
+aGroup4.SetColor( SALOMEDS.Color(1.,0.,0.));
# create union group : area >= 20 and area < 20
aGroup5 = mesh.UnionListOfGroups([aGroup3, aGroup4], "Any Area")
# create a group by adding elements with area > 100
aSrcGroup1 = mesh.GroupOnFilter(SMESH.FACE, "Area > 100", aFilter)
+aSrcGroup1.SetColor( SALOMEDS.Color(1.,1.,0.))
print "Criterion: Area > 100, Nb = ", aSrcGroup1.Size()
# Criterion : AREA < 30
# create a group by adding elements with area < 30
aSrcGroup2 = mesh.GroupOnFilter(SMESH.FACE, "Area < 30", aFilter)
+aSrcGroup2.SetColor( SALOMEDS.Color(1.,0.,0.))
print "Criterion: Area < 30, Nb = ", aSrcGroup2.Size()
\tui_script{a3DmeshOnModified2Dmesh.py}
<br>
-\section tui_editing_mesh Editing a mesh
+\section tui_editing_mesh Editing a mesh (i.e. changing hypotheses)
\tui_script{creating_meshes_ex04.py}
<br>
\image html editing_groups1.png
-\image html editing_groups2.png
-
<br>
\section tui_union_of_groups Union of groups
\tui_script{grouping_elements_ex05.py}
\image html union_groups1.png
-\image html union_groups2.png
-
-\image html union_groups3.png
-
<br>
\section tui_intersection_of_groups Intersection of groups
\tui_script{grouping_elements_ex06.py}
\image html intersect_groups1.png
-\image html intersect_groups2.png
-
-\image html intersect_groups3.png
-
<br>
\section tui_cut_of_groups Cut of groups
\tui_script{grouping_elements_ex07.py}
\image html cut_groups1.png
-\image html cut_groups2.png
-
-\image html cut_groups3.png
-
<br>
-\section tui_create_dim_group Creating groups of entities from existing groups of superior dimensions
+\section tui_create_dim_group Creating groups of entities basing on nodes of other groups
\tui_script{grouping_elements_ex08.py}
\image html dimgroup_tui1.png
-<center>Source groups of faces</center>
-
-\image html dimgroup_tui2.png
-<center>Result groups of edges and nodes</center>
char *file2Read = (char *)myFile.c_str();
FILE* aFileId = fopen(file2Read, "w+");
- if ( !aFileId ) {
+ if ( !aFileId )
+ {
fprintf(stderr, ">> ERREUR : ouverture du fichier %s \n", file2Read);
return DRS_FAIL;
}
****************************************************************************/
SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
- while(itNodes->more()){
+ while(itNodes->more())
+ {
const SMDS_MeshNode * node = itNodes->next();
fprintf(aFileId, "%d %.14e %.14e %.14e\n", node->GetID(), node->X(), node->Y(), node->Z());
}
-
+
/****************************************************************************
* ECRITURE DES ELEMENTS *
****************************************************************************/
/* Ecriture des connectivites, noms, numeros des mailles */
-
+
SMDS_EdgeIteratorPtr itEdges=myMesh->edgesIterator();
- while(itEdges->more()){
+ while(itEdges->more())
+ {
const SMDS_MeshElement * elem = itEdges->next();
- switch (elem->NbNodes()) {
+ switch (elem->NbNodes())
+ {
case 2:
fprintf(aFileId, "%d %d ", elem->GetID(), 102);
break;
break;
}
SMDS_ElemIteratorPtr it=elem->nodesIterator();
- while(it->more())
+ while(it->more())
fprintf(aFileId, "%d ", it->next()->GetID());
fprintf(aFileId, "\n");
}
-
+
SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
- while(itFaces->more()){
+ while(itFaces->more())
+ {
const SMDS_MeshElement * elem = itFaces->next();
if ( elem->IsPoly() )
fprintf(aFileId, "%d %d ", elem->GetID(), 400+elem->NbNodes());
else
fprintf(aFileId, "%d %d ", elem->GetID(), 200+elem->NbNodes());
SMDS_ElemIteratorPtr it=elem->nodesIterator();
- while(it->more())
+ while(it->more())
fprintf(aFileId, "%d ", it->next()->GetID());
fprintf(aFileId, "\n");
}
SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
- while(itVolumes->more()){
+ const SMDS_VtkVolume* v;
+ while(itVolumes->more())
+ {
const SMDS_MeshElement * elem = itVolumes->next();
if ( elem->IsPoly() )
+ {
fprintf(aFileId, "%d %d ", elem->GetID(), 500+elem->NbNodes());
+
+ if (( v = dynamic_cast< const SMDS_VtkVolume*>( elem )))
+ {
+ std::vector<int> quant = v->GetQuantities();
+ if ( !quant.empty() )
+ {
+ fprintf(aFileId, "%d %d ", quant.size(), quant[0]);
+ for ( size_t i = 1; i < quant.size(); ++i )
+ fprintf(aFileId, "%d ", quant[i]);
+ }
+ }
+ }
else
+ {
fprintf(aFileId, "%d %d ", elem->GetID(), 300+elem->NbNodes());
+ }
SMDS_ElemIteratorPtr it=elem->nodesIterator();
- while(it->more())
+ while(it->more())
fprintf(aFileId, "%d ", it->next()->GetID());
fprintf(aFileId, "\n");
SMESH_MesherHelper eHelper( *myProxyMesh->GetMesh() );
SMESH_MesherHelper fHelper( *myProxyMesh->GetMesh() );
fHelper.SetSubShape( myFace );
- bool paramOK;
+ bool paramOK = true;
double eps = 1e-100;
// sort nodes of all edges by putting them into a map