PR: debug G. Nicolas (EDF 1967)

This commit is contained in:
prascle 2013-04-05 15:19:53 +00:00
parent c2dc77e7c1
commit 9c2ce3dffb
3 changed files with 79 additions and 22 deletions

View File

@ -7,11 +7,16 @@
<h2>Double nodes on groups boundaries</h2> <h2>Double nodes on groups boundaries</h2>
\n Double nodes on shared faces between groups of volumes and create flat elements on demand. \n Double nodes on shared faces between groups of volumes and create flat elements on demand.
\n The list of groups must describe a partition of the mesh volumes. The nodes of the internal \n The list of groups must contain at least two groups. The groups have to be disjoint: no common element into two different groups.
faces at the boundaries of the groups are doubled. Optionally, the internal faces are replaced \n The nodes of the internal faces at the boundaries of the groups are doubled. Optionally, the internal faces are replaced
by flat elements. by flat elements.
\n Triangles are transformed into prisms, and quadrangles into hexahedrons. \n Triangles are transformed into prisms, and quadrangles into hexahedrons.
\n The flat elements are stored in groups of volumes. \n The flat elements are stored in groups of volumes.
These groups are named according to the position of the group in the list:
the group j_n_p is the group of the flat elements that are built between the group #n and the group #p in the list.
If there is no shared faces between the group #n and the group #p in the list, the group j_n_p is not created.
All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation).
The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples".
\n \n
\n This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder). \n This example represents an iron cable (a thin cylinder) in a concrete bloc (a big cylinder).

View File

@ -11251,11 +11251,14 @@ double SMESH_MeshEditor::OrientedAngle(const gp_Pnt& p0, const gp_Pnt& p1, const
/*! /*!
* \brief Double nodes on shared faces between groups of volumes and create flat elements on demand. * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
* The list of groups must describe a partition of the mesh volumes. * The list of groups must contain at least two groups. The groups have to be disjoint: no common element into two different groups.
* The nodes of the internal faces at the boundaries of the groups are doubled. * The nodes of the internal faces at the boundaries of the groups are doubled. Optionally, the internal faces are replaced by flat elements.
* In option, the internal faces are replaced by flat elements. * Triangles are transformed into prisms, and quadrangles into hexahedrons.
* Triangles are transformed in prisms, and quadrangles in hexahedrons. * The flat elements are stored in groups of volumes. These groups are named according to the position of the group in the list:
* The flat elements are stored in groups of volumes. * the group j_n_p is the group of the flat elements that are built between the group #n and the group #p in the list.
* If there is no shared faces between the group #n and the group #p in the list, the group j_n_p is not created.
* All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation).
* The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples".
* @param theElems - list of groups of volumes, where a group of volume is a set of * @param theElems - list of groups of volumes, where a group of volume is a set of
* SMDS_MeshElements sorted by Id. * SMDS_MeshElements sorted by Id.
* @param createJointElems - if TRUE, create the elements * @param createJointElems - if TRUE, create the elements
@ -11289,6 +11292,32 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
std::set<int> emptySet; std::set<int> emptySet;
emptyMap.clear(); emptyMap.clear();
MESSAGE(".. Number of domains :"<<theElems.size());
// Check if the domains do not share an element
for (int idom = 0; idom < theElems.size()-1; idom++)
{
// MESSAGE("... Check of domain #" << idom);
const TIDSortedElemSet& domain = theElems[idom];
TIDSortedElemSet::const_iterator elemItr = domain.begin();
for (; elemItr != domain.end(); ++elemItr)
{
SMDS_MeshElement* anElem = (SMDS_MeshElement*) *elemItr;
int idombisdeb = idom + 1 ;
for (int idombis = idombisdeb; idombis < theElems.size(); idombis++) // check if the element belongs to a domain further in the list
{
const TIDSortedElemSet& domainbis = theElems[idombis];
if ( domainbis.count(anElem) )
{
MESSAGE(".... Domain #" << idom);
MESSAGE(".... Domain #" << idombis);
throw SALOME_Exception("The domains are not disjoint.");
return false ;
}
}
}
}
for (int idom = 0; idom < theElems.size(); idom++) for (int idom = 0; idom < theElems.size(); idom++)
{ {
@ -11297,7 +11326,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
// and corresponding volume of this domain, for each shared face. // and corresponding volume of this domain, for each shared face.
// a volume has a face shared by 2 domains if it has a neighbor which is not in his domain. // a volume has a face shared by 2 domains if it has a neighbor which is not in his domain.
//MESSAGE("Domain " << idom); MESSAGE("... Neighbors of domain #" << idom);
const TIDSortedElemSet& domain = theElems[idom]; const TIDSortedElemSet& domain = theElems[idom];
TIDSortedElemSet::const_iterator elemItr = domain.begin(); TIDSortedElemSet::const_iterator elemItr = domain.begin();
for (; elemItr != domain.end(); ++elemItr) for (; elemItr != domain.end(); ++elemItr)
@ -11317,15 +11346,25 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
const SMDS_MeshElement* elem = meshDS->FindElement(smdsId); const SMDS_MeshElement* elem = meshDS->FindElement(smdsId);
if (! domain.count(elem)) // neighbor is in another domain : face is shared if (! domain.count(elem)) // neighbor is in another domain : face is shared
{ {
DownIdType face(downIds[n], downTypes[n]); bool ok = false ;
if (!faceDomains.count(face)) for (int idombis = 0; idombis < theElems.size(); idombis++) // check if the neighbor belongs to another domain of the list
faceDomains[face] = emptyMap; // create an empty entry for face {
if (!faceDomains[face].count(idom)) // MESSAGE("Domain " << idombis);
{ const TIDSortedElemSet& domainbis = theElems[idombis];
faceDomains[face][idom] = vtkId; // volume associated to face in this domain if ( domainbis.count(elem)) ok = true ; // neighbor is in a correct domain : face is kept
celldom[vtkId] = idom; }
//MESSAGE(" cell with a border " << vtkId << " domain " << idom); if ( ok ) // the characteristics of the face is stored
} {
DownIdType face(downIds[n], downTypes[n]);
if (!faceDomains.count(face))
faceDomains[face] = emptyMap; // create an empty entry for face
if (!faceDomains[face].count(idom))
{
faceDomains[face][idom] = vtkId; // volume associated to face in this domain
celldom[vtkId] = idom;
//MESSAGE(" cell with a border " << vtkId << " domain " << idom);
}
}
} }
} }
} }
@ -11396,6 +11435,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
std::map<int, std::vector<int> > mutipleNodes; // nodes multi domains with domain order std::map<int, std::vector<int> > mutipleNodes; // nodes multi domains with domain order
std::map<int, std::vector<int> > mutipleNodesToFace; // nodes multi domains with domain order to transform in Face (junction between 3 or more 2D domains) std::map<int, std::vector<int> > mutipleNodesToFace; // nodes multi domains with domain order to transform in Face (junction between 3 or more 2D domains)
MESSAGE(".. Duplication of the nodes");
for (int idomain = 0; idomain < theElems.size(); idomain++) for (int idomain = 0; idomain < theElems.size(); idomain++)
{ {
itface = faceDomains.begin(); itface = faceDomains.begin();
@ -11458,6 +11498,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
} }
} }
MESSAGE(".. Creation of elements");
for (int idomain = 0; idomain < theElems.size(); idomain++) for (int idomain = 0; idomain < theElems.size(); idomain++)
{ {
itface = faceDomains.begin(); itface = faceDomains.begin();
@ -11587,6 +11628,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
std::map<int, std::map<long,int> > nodeQuadDomains; std::map<int, std::map<long,int> > nodeQuadDomains;
std::map<std::string, SMESH_Group*> mapOfJunctionGroups; std::map<std::string, SMESH_Group*> mapOfJunctionGroups;
MESSAGE(".. Creation of elements: simple junction");
if (createJointElems) if (createJointElems)
{ {
int idg; int idg;
@ -11637,6 +11679,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
// iterate on mutipleNodesToFace // iterate on mutipleNodesToFace
// iterate on edgesMultiDomains // iterate on edgesMultiDomains
MESSAGE(".. Creation of elements: multiple junction");
if (createJointElems) if (createJointElems)
{ {
// --- iterate on mutipleNodesToFace // --- iterate on mutipleNodesToFace
@ -11709,6 +11752,7 @@ bool SMESH_MeshEditor::DoubleNodesOnGroupBoundaries( const std::vector<TIDSorted
faceOrEdgeDom.clear(); faceOrEdgeDom.clear();
feDom.clear(); feDom.clear();
MESSAGE(".. Modification of elements");
for (int idomain = 0; idomain < theElems.size(); idomain++) for (int idomain = 0; idomain < theElems.size(); idomain++)
{ {
std::map<int, std::map<int, int> >::const_iterator itnod = nodeDomains.begin(); std::map<int, std::map<int, int> >::const_iterator itnod = nodeDomains.begin();

View File

@ -6580,13 +6580,18 @@ CORBA::Boolean SMESH_MeshEditor_i::Make2DMeshFrom3D()
//================================================================================ //================================================================================
/*! /*!
* \brief Double nodes on shared faces between groups of volumes and create flat * \brief Double nodes on shared faces between groups of volumes and create flat elements on demand.
* elements on demand. * The list of groups must contain at least two groups. The groups have to be disjoint:
* The list of groups must describe a partition of the mesh volumes. * no common element into two different groups.
* The nodes of the internal faces at the boundaries of the groups are doubled. * The nodes of the internal faces at the boundaries of the groups are doubled.
* In option, the internal faces are replaced by flat elements. * Optionally, the internal faces are replaced by flat elements.
* Triangles are transformed in prisms, and quadrangles in hexahedrons. * Triangles are transformed into prisms, and quadrangles into hexahedrons.
* The flat elements are stored in groups of volumes. * The flat elements are stored in groups of volumes.
* These groups are named according to the position of the group in the list:
* the group j_n_p is the group of the flat elements that are built between the group #n and the group #p in the list.
* If there is no shared faces between the group #n and the group #p in the list, the group j_n_p is not created.
* All the flat elements are gathered into the group named "joints3D" (or "joints2D" in 2D situation).
* The flat element of the multiple junctions between the simple junction are stored in a group named "jointsMultiples".
* @param theDomains - list of groups of volumes * @param theDomains - list of groups of volumes
* @param createJointElems - if TRUE, create the elements * @param createJointElems - if TRUE, create the elements
* @return TRUE if operation has been completed successfully, FALSE otherwise * @return TRUE if operation has been completed successfully, FALSE otherwise
@ -6605,6 +6610,9 @@ SMESH_MeshEditor_i::DoubleNodesOnGroupBoundaries( const SMESH::ListOfGroups& the
SMESHDS_Mesh* aMeshDS = getMeshDS(); SMESHDS_Mesh* aMeshDS = getMeshDS();
// MESSAGE("theDomains.length = "<<theDomains.length());
if ( theDomains.length() <= 1 )
THROW_SALOME_CORBA_EXCEPTION("At least 2 groups are required.", SALOME::BAD_PARAM);
vector<TIDSortedElemSet> domains; vector<TIDSortedElemSet> domains;
domains.clear(); domains.clear();