HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues::const_iterator vertexIt;
std::vector<double> enfVertexSizes;
const SMDS_MeshElement* elem;
- TIDSortedElemSet anElemSet, theKeptEnforcedEdges, theKeptEnforcedTriangles;
+ TIDSortedElemSet anElemSetTri, anElemSetQuad, theKeptEnforcedEdges, theKeptEnforcedTriangles;
SMDS_ElemIteratorPtr nodeIt;
std::vector <const SMDS_MeshNode*> theEnforcedNodeByHybridId;
std::map<const SMDS_MeshNode*,int> anEnforcedNodeToHybridIdMap, anExistingEnforcedNodeToHybridIdMap;
while ( eIt->more() )
{
elem = eIt->next();
- anElemSet.insert(elem);
nodeIt = elem->nodesIterator();
nbNodes = elem->NbCornerNodes();
+ if (nbNodes == 3)
+ anElemSetTri.insert(elem);
+ else if (nbNodes == 4)
+ anElemSetQuad.insert(elem);
+ else
+ {
+ std::cout << "Unexpected number of nodes: " << nbNodes << std::endl;
+ throw ("Unexpected number of nodes" );
+ }
while ( nodeIt->more() && nbNodes--)
{
// find HYBRID ID
std::cout << "End writing in req and sol file" << std::endl;
}
- int nedge[2], ntri[3];
+ int nedge[2], ntri[3], nquad[4];
// GmfEdges
int usedEnforcedEdges = 0;
// GmfTriangles
int usedEnforcedTriangles = 0;
- if (anElemSet.size()+theKeptEnforcedTriangles.size()) {
- aFaceGroupByHybridId.resize( anElemSet.size()+theKeptEnforcedTriangles.size() );
- MGInput->GmfSetKwd(idx, GmfTriangles, anElemSet.size()+theKeptEnforcedTriangles.size());
+ if (anElemSetTri.size()+theKeptEnforcedTriangles.size()) {
+ aFaceGroupByHybridId.resize( anElemSetTri.size()+theKeptEnforcedTriangles.size() );
+ MGInput->GmfSetKwd(idx, GmfTriangles, anElemSetTri.size()+theKeptEnforcedTriangles.size());
int k=0;
- for(elemSetIt = anElemSet.begin() ; elemSetIt != anElemSet.end() ; ++elemSetIt,++k) {
+ for(elemSetIt = anElemSetTri.begin() ; elemSetIt != anElemSetTri.end() ; ++elemSetIt,++k) {
elem = (*elemSetIt);
theFaceByHybridId.push_back( elem );
nodeIt = elem->nodesIterator();
if (usedEnforcedTriangles) {
MGInput->GmfSetKwd(idx, GmfRequiredTriangles, usedEnforcedTriangles);
for (int enfID=1;enfID<=usedEnforcedTriangles;enfID++)
- MGInput->GmfSetLin(idx, GmfRequiredTriangles, anElemSet.size()+enfID);
+ MGInput->GmfSetLin(idx, GmfRequiredTriangles, anElemSetTri.size()+enfID);
+ }
+
+ if (anElemSetQuad.size()) {
+ MGInput->GmfSetKwd(idx, GmfQuadrilaterals, anElemSetQuad.size());
+ int k=0;
+ for(elemSetIt = anElemSetQuad.begin() ; elemSetIt != anElemSetQuad.end() ; ++elemSetIt,++k) {
+ elem = (*elemSetIt);
+ theFaceByHybridId.push_back( elem );
+ nodeIt = elem->nodesIterator();
+ int index=0;
+ for ( int j = 0; j < 4; ++j ) {
+ // find HYBRID ID
+ const SMDS_MeshNode* node = castToNode( nodeIt->next() );
+ std::map< const SMDS_MeshNode*,int >::iterator it = aNodeToHybridIdMap.find(node);
+ if (it == aNodeToHybridIdMap.end())
+ throw "Node not found";
+ nquad[index] = it->second;
+ index++;
+ }
+ MGInput->GmfSetLin(idx, GmfQuadrilaterals, nquad[0], nquad[1], nquad[2], nquad[3], dummyint5);
+ // _CEA_cbo what is it for???
+ //aFaceGroupByHybridId[k] = "";
+ }
}
MGInput->GmfCloseMesh(idx);