#define HOLE_ID -1
+// flags returning state of enforced entities, returned from writeGMFFile
+enum InvalidEnforcedFlags { FLAG_BAD_ENF_VERT = 1,
+ FLAG_BAD_ENF_NODE = 2,
+ FLAG_BAD_ENF_EDGE = 4,
+ FLAG_BAD_ENF_TRIA = 8
+};
+static std::string flagsToErrorStr( int anInvalidEnforcedFlags )
+{
+ std::string str;
+ if ( anInvalidEnforcedFlags != 0 )
+ {
+ if ( anInvalidEnforcedFlags & FLAG_BAD_ENF_VERT )
+ str = "There are enforced vertices incorrectly defined.\n";
+ if ( anInvalidEnforcedFlags & FLAG_BAD_ENF_NODE )
+ str += "There are enforced nodes incorrectly defined.\n";
+ if ( anInvalidEnforcedFlags & FLAG_BAD_ENF_EDGE )
+ str += "There are enforced edge incorrectly defined.\n";
+ if ( anInvalidEnforcedFlags & FLAG_BAD_ENF_TRIA )
+ str += "There are enforced triangles incorrectly defined.\n";
+ }
+ return str;
+}
+
typedef const list<const SMDS_MeshFace*> TTriaList;
static const char theDomainGroupNamePrefix[] = "Domain_";
GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedEdges,
GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap & theEnforcedTriangles,
std::map<std::vector<double>, std::string> & enfVerticesWithGroup,
- GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues & theEnforcedVertices)
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues & theEnforcedVertices,
+ int & theInvalidEnforcedFlags)
{
MESSAGE("writeGMFFile w/o geometry");
std::string tmpStr;
( SMESH_MeshAlgos::GetElementSearcher(*theMesh->GetMeshDS()));
int nbEnforcedVertices = theEnforcedVertices.size();
-
+ theInvalidEnforcedFlags = 0;
+
// count faces
int nbFaces = theProxyMesh.NbFaces();
int nbNodes;
TopAbs_State result = pntCls->GetPointState( myPoint );
if ( result == TopAbs_OUT ) {
isOK = false;
+ theInvalidEnforcedFlags |= FLAG_BAD_ENF_EDGE;
break;
}
aNodeToTopAbs_StateMap.insert( make_pair( node, result ));
}
if (isOK)
theKeptEnforcedEdges.insert(elem);
+ else
+ theInvalidEnforcedFlags |= FLAG_BAD_ENF_EDGE;
}
}
TopAbs_State result = pntCls->GetPointState( myPoint );
if ( result == TopAbs_OUT ) {
isOK = false;
+ theInvalidEnforcedFlags |= FLAG_BAD_ENF_TRIA;
break;
}
aNodeToTopAbs_StateMap.insert( make_pair( node, result ));
}
if (isOK)
theKeptEnforcedTriangles.insert(elem);
+ else
+ theInvalidEnforcedFlags |= FLAG_BAD_ENF_TRIA;
}
}
#ifdef _DEBUG_
std::cout << " out of volume" << std::endl;
#endif
+ theInvalidEnforcedFlags |= FLAG_BAD_ENF_NODE;
continue;
}
gp_Pnt myPoint(x,y,z);
TopAbs_State result = pntCls->GetPointState( myPoint );
if ( result == TopAbs_OUT )
- continue;
- //if (pntCls->FindElementsByPoint(myPoint, SMDSAbs_Node, foundElems) == 0)
- //continue;
-
-// if ( result != TopAbs_IN )
-// continue;
+ {
+ std::cout << "Warning: enforced vertex at ( " << x << "," << y << "," << z << " ) is out of the meshed domain!!!" << std::endl;
+ theInvalidEnforcedFlags |= FLAG_BAD_ENF_VERT;
+ //continue;
+ }
std::vector<double> coords;
coords.push_back(x);
coords.push_back(y);
// writeFaces ( aFacesFile, *proxyMesh, theShape,
// aSmdsToGhs3dIdMap, anEnforcedNodeIdToGhs3dIdMap,
// enforcedEdges, enforcedTriangles ));
+ int anInvalidEnforcedFlags = 0;
Ok = writeGMFFile(aGMFFileName.ToCString(), aRequiredVerticesFileName.ToCString(), aSolFileName.ToCString(),
*proxyMesh, helper,
aNodeByGhs3dId, aFaceByGhs3dId, aNodeToGhs3dIdMap,
aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId,
enforcedNodes, enforcedEdges, enforcedTriangles, /*enforcedQuadrangles,*/
- enfVerticesWithGroup, coordsSizeMap);
+ enfVerticesWithGroup, coordsSizeMap, anInvalidEnforcedFlags);
//}
// Write aSmdsToGhs3dIdMap to temp file
if ( Ok )
{
+ if ( anInvalidEnforcedFlags )
+ error( COMPERR_WARNING, flagsToErrorStr( anInvalidEnforcedFlags ));
if ( _removeLogOnSuccess )
removeFile( aLogFileName );
-
// if ( _hyp && _hyp->GetToMakeGroupsOfDomains() )
// error( COMPERR_WARNING, "'toMakeGroupsOfDomains' is ignored since the mesh is on shape" );
}
proxyMesh.reset( aQuad2Trias );
}
+ int anInvalidEnforcedFlags = 0;
Ok = writeGMFFile(aGMFFileName.ToCString(), aRequiredVerticesFileName.ToCString(), aSolFileName.ToCString(),
*proxyMesh, *theHelper,
aNodeByGhs3dId, aFaceByGhs3dId, aNodeToGhs3dIdMap,
aNodeGroupByGhs3dId, anEdgeGroupByGhs3dId, aFaceGroupByGhs3dId,
enforcedNodes, enforcedEdges, enforcedTriangles,
- enfVerticesWithGroup, coordsSizeMap);
+ enfVerticesWithGroup, coordsSizeMap, anInvalidEnforcedFlags);
//}
// -----------------
if ( Ok )
{
+ if ( anInvalidEnforcedFlags )
+ error( COMPERR_WARNING, flagsToErrorStr( anInvalidEnforcedFlags ));
if ( _removeLogOnSuccess )
removeFile( aLogFileName );