tests on memory measurements

This commit is contained in:
Paul RASCLE 2016-04-15 17:51:36 +02:00
parent 7fd18ae8b1
commit 05cbd0eed8
2 changed files with 14 additions and 6 deletions

View File

@ -30,14 +30,14 @@ void memostat(const char* f, int l)
#ifdef WIN32 #ifdef WIN32
//rnv: TODO: find alternative of the malloc_stats() on windows platform //rnv: TODO: find alternative of the malloc_stats() on windows platform
#else #else
/* struct mallinfo mem = mallinfo(); */ struct mallinfo mem = mallinfo();
/* std::cerr << f << ":"<< l << " " << mem.arena << " " << mem.ordblks << " " << mem.hblks << " " << mem.hblkhd << " " << mem.uordblks << " " << mem.fordblks << " " << mem.keepcost << std::endl; */ std::cerr << f << ":"<< l << " " << mem.arena << " " << mem.ordblks << " " << mem.hblks << " " << mem.hblkhd << " " << mem.uordblks << " " << mem.fordblks << " " << mem.keepcost << std::endl;
std::cerr << f << ":" << l << " --------------------------" << std::endl; std::cerr << f << ":" << l << " --------------------------" << std::endl;
malloc_stats(); malloc_stats();
std::cerr << f << ":" << l << " --------------------------" << std::endl; std::cerr << f << ":" << l << " --------------------------" << std::endl;
#endif #endif
} }
#define MEMOSTAT //memostat( __FILE__, __LINE__ ) #define MEMOSTAT memostat( __FILE__, __LINE__ )
#endif #endif

View File

@ -184,6 +184,7 @@ bool StdMeshers_Regular_1D::CheckHypothesis( SMESH_Mesh& aMesh,
else if (hypName == "NumberOfSegments") else if (hypName == "NumberOfSegments")
{ {
MESSAGE("CheckHypothesis: NumberOfSegments");
const StdMeshers_NumberOfSegments * hyp = const StdMeshers_NumberOfSegments * hyp =
dynamic_cast <const StdMeshers_NumberOfSegments * >(theHyp); dynamic_cast <const StdMeshers_NumberOfSegments * >(theHyp);
ASSERT(hyp); ASSERT(hyp);
@ -591,6 +592,7 @@ void StdMeshers_Regular_1D::redistributeNearVertices (SMESH_Mesh & theM
} }
if ( _hypType == NB_SEGMENTS ) if ( _hypType == NB_SEGMENTS )
{ {
MESSAGE("redistributeNearVertices NB_SEGMENTS");
compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true ); compensateError(0, vertexLength, f, l, theLength, theC3d, theParameters, true );
} }
else if ( nPar <= 3 ) else if ( nPar <= 3 )
@ -665,6 +667,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
const bool theReverse, const bool theReverse,
bool theConsiderPropagation) bool theConsiderPropagation)
{ {
MESSAGE("computeInternalParameters");
theParams.clear(); theParams.clear();
double f = theFirstU, l = theLastU; double f = theFirstU, l = theLastU;
@ -686,7 +689,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
if ( ! SMESH_Algo::GetSortedNodesOnEdge( theMesh.GetMeshDS(), mainEdge, _quadraticMesh, if ( ! SMESH_Algo::GetSortedNodesOnEdge( theMesh.GetMeshDS(), mainEdge, _quadraticMesh,
mainEdgeParamsOfNodes, SMDSAbs_Edge )) mainEdgeParamsOfNodes, SMDSAbs_Edge ))
return error("Bad node parameters on the source edge of Propagation Of Distribution"); return error("Bad node parameters on the source edge of Propagation Of Distribution");
MESSAGE("mainEdgeParamsOfNodes.size(): " << mainEdgeParamsOfNodes.size());
vector< double > segLen( mainEdgeParamsOfNodes.size() - 1 ); vector< double > segLen( mainEdgeParamsOfNodes.size() - 1 );
double totalLen = 0; double totalLen = 0;
BRepAdaptor_Curve mainEdgeCurve( mainEdge ); BRepAdaptor_Curve mainEdgeCurve( mainEdge );
@ -715,7 +718,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
++nbParams; ++nbParams;
} }
if ( nbParams != segLen.size()-1 ) if ( nbParams != segLen.size()-1 )
return error( SMESH_Comment("Can't divide into ") << segLen.size() << " segements"); return error( SMESH_Comment("Can't divide into ") << segLen.size() << " segments");
compensateError( segLen[ theReverse ? segLen.size()-1 : 0 ], compensateError( segLen[ theReverse ? segLen.size()-1 : 0 ],
segLen[ theReverse ? 0 : segLen.size()-1 ], segLen[ theReverse ? 0 : segLen.size()-1 ],
@ -729,7 +732,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
case LOCAL_LENGTH: case LOCAL_LENGTH:
case MAX_LENGTH: case MAX_LENGTH:
case NB_SEGMENTS: { case NB_SEGMENTS: {
MESSAGE("computeInternalParameters: LOCAL_LENGTH MAX_LENGTH NB_SEGMENTS");
double eltSize = 1; double eltSize = 1;
int nbSegments; int nbSegments;
if ( _hypType == MAX_LENGTH ) if ( _hypType == MAX_LENGTH )
@ -762,6 +765,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
if (computed) { if (computed) {
SMESHDS_SubMesh* smds = sm->GetSubMeshDS(); SMESHDS_SubMesh* smds = sm->GetSubMeshDS();
int nb_segments = smds->NbElements(); int nb_segments = smds->NbElements();
MESSAGE("nb_segments: "<<nb_segments);
if (nbseg - 1 <= nb_segments && nb_segments <= nbseg + 1) { if (nbseg - 1 <= nb_segments && nb_segments <= nbseg + 1) {
isFound = true; isFound = true;
nbseg = nb_segments; nbseg = nb_segments;
@ -842,6 +846,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
break; break;
case StdMeshers_NumberOfSegments::DT_Regular: case StdMeshers_NumberOfSegments::DT_Regular:
eltSize = theLength / nbSegments; eltSize = theLength / nbSegments;
MESSAGE("eltSize = theLength / nbSegments " << eltSize << " = " << theLength << " / " << nbSegments );
break; break;
default: default:
return false; return false;
@ -855,6 +860,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
for ( int i = 2; i < NbPoints; i++ ) // skip 1st and last points for ( int i = 2; i < NbPoints; i++ ) // skip 1st and last points
{ {
double param = Discret.Parameter(i); double param = Discret.Parameter(i);
MESSAGE("computeInternalParameters: theParams " << i << " " << param);
theParams.push_back( param ); theParams.push_back( param );
} }
compensateError( eltSize, eltSize, f, l, theLength, theC3d, theParams, true ); // for PAL9899 compensateError( eltSize, eltSize, f, l, theLength, theC3d, theParams, true ); // for PAL9899
@ -1108,6 +1114,7 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & theShape) bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & theShape)
{ {
MESSAGE("Compute");
if ( _hypType == NONE ) if ( _hypType == NONE )
return false; return false;
@ -1207,6 +1214,7 @@ bool StdMeshers_Regular_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & t
//Add the Node in the DataStructure //Add the Node in the DataStructure
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()); SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
MESSAGE("meshDS->AddNode parameter " << param << " coords=" << "("<< P.X() <<", " << P.Y() << ", " << P.Z() << ")");
meshDS->SetNodeOnEdge(node, shapeID, param); meshDS->SetNodeOnEdge(node, shapeID, param);
if(_quadraticMesh) { if(_quadraticMesh) {