Compare commits

...

1 Commits

Author SHA1 Message Date
eap
289161ca83 bos #20256: [CEA 18523] Porting SMESH to int 64 bits 2021-03-17 18:14:10 +03:00
11 changed files with 81 additions and 81 deletions

View File

@ -248,12 +248,12 @@ module NETGENPlugin
/*! /*!
* Sets <number of segments> value * Sets <number of segments> value
*/ */
void SetNumberOfSegments(in short nb) raises (SALOME::SALOME_Exception); void SetNumberOfSegments(in long nb) raises (SALOME::SALOME_Exception);
/*! /*!
* Returns <number of segments> value. * Returns <number of segments> value.
* Can be zero in case if LocalLength() has been set * Can be zero in case if LocalLength() has been set
*/ */
short GetNumberOfSegments(); long GetNumberOfSegments();
/*! /*!
* Sets <segment length> value * Sets <segment length> value

View File

@ -761,7 +761,7 @@ bool NETGENPluginGUI_HypothesisCreator::readParamsFromHypo( NetgenHypothesisData
NETGENPluginGUI_HypothesisCreator* that = (NETGENPluginGUI_HypothesisCreator*)this; NETGENPluginGUI_HypothesisCreator* that = (NETGENPluginGUI_HypothesisCreator*)this;
NETGENPlugin::string_array_var myEntries = h->GetLocalSizeEntries(); NETGENPlugin::string_array_var myEntries = h->GetLocalSizeEntries();
for ( size_t i = 0; i < myEntries->length(); i++ ) for ( CORBA::ULong i = 0; i < myEntries->length(); i++ )
{ {
QString entry = myEntries[i].in(); QString entry = myEntries[i].in();
if (myLocalSizeMap.contains(entry) && if (myLocalSizeMap.contains(entry) &&
@ -826,17 +826,17 @@ bool NETGENPluginGUI_HypothesisCreator::storeParamsToHypo( const NetgenHypothesi
if ( myNbSurfOptSteps ) if ( myNbSurfOptSteps )
{ {
h->SetVarParameter ( h_data.myNbSurfOptStepsVar.toLatin1().constData(), "SetNbSurfOptSteps"); h->SetVarParameter ( h_data.myNbSurfOptStepsVar.toLatin1().constData(), "SetNbSurfOptSteps");
h->SetNbSurfOptSteps( h_data.myNbSurfOptSteps ); h->SetNbSurfOptSteps((CORBA::Short) h_data.myNbSurfOptSteps );
} }
if ( myNbVolOptSteps ) if ( myNbVolOptSteps )
{ {
h->SetVarParameter ( h_data.myNbVolOptStepsVar.toLatin1().constData(), "SetNbVolOptSteps"); h->SetVarParameter ( h_data.myNbVolOptStepsVar.toLatin1().constData(), "SetNbVolOptSteps");
h->SetNbVolOptSteps( h_data.myNbVolOptSteps ); h->SetNbVolOptSteps((CORBA::Short) h_data.myNbVolOptSteps );
} }
if ( myFuseEdges ) if ( myFuseEdges )
h->SetFuseEdges( h_data.myFuseEdges ); h->SetFuseEdges( h_data.myFuseEdges );
h->SetVarParameter ( h_data.myWorstElemMeasureVar.toLatin1().constData(), "SetWorstElemMeasure"); h->SetVarParameter ( h_data.myWorstElemMeasureVar.toLatin1().constData(), "SetWorstElemMeasure");
h->SetWorstElemMeasure( h_data.myWorstElemMeasure ); h->SetWorstElemMeasure((CORBA::Short) h_data.myWorstElemMeasure );
h->SetUseDelauney( h_data.myUseDelauney ); h->SetUseDelauney( h_data.myUseDelauney );
h->SetCheckOverlapping( h_data.myCheckOverlapping ); h->SetCheckOverlapping( h_data.myCheckOverlapping );

View File

@ -373,7 +373,7 @@ NETGENPlugin::string_array* NETGENPlugin_Hypothesis_i::GetLocalSizeEntries()
NETGENPlugin::string_array_var result = new NETGENPlugin::string_array(); NETGENPlugin::string_array_var result = new NETGENPlugin::string_array();
const ::NETGENPlugin_Hypothesis::TLocalSize localSizes = const ::NETGENPlugin_Hypothesis::TLocalSize localSizes =
this->GetImpl()->GetLocalSizesAndEntries(); this->GetImpl()->GetLocalSizesAndEntries();
result->length(localSizes.size()); result->length((CORBA::ULong) localSizes.size());
::NETGENPlugin_Hypothesis::TLocalSize::const_iterator it = localSizes.begin(); ::NETGENPlugin_Hypothesis::TLocalSize::const_iterator it = localSizes.begin();
for (int i=0 ; it != localSizes.end() ; i++, it++) for (int i=0 ; it != localSizes.end() ; i++, it++)
{ {
@ -490,7 +490,7 @@ void NETGENPlugin_Hypothesis_i::SetNbSurfOptSteps(CORBA::Short nb )
CORBA::Short NETGENPlugin_Hypothesis_i::GetNbSurfOptSteps() CORBA::Short NETGENPlugin_Hypothesis_i::GetNbSurfOptSteps()
{ {
return GetImpl()->GetNbSurfOptSteps(); return (CORBA::Short) GetImpl()->GetNbSurfOptSteps();
} }
//======================================================================= //=======================================================================
@ -515,7 +515,7 @@ void NETGENPlugin_Hypothesis_i::SetNbVolOptSteps(CORBA::Short nb )
CORBA::Short NETGENPlugin_Hypothesis_i::GetNbVolOptSteps() CORBA::Short NETGENPlugin_Hypothesis_i::GetNbVolOptSteps()
{ {
return GetImpl()->GetNbVolOptSteps(); return (CORBA::Short) GetImpl()->GetNbVolOptSteps();
} }
//======================================================================= //=======================================================================
@ -563,7 +563,7 @@ void NETGENPlugin_Hypothesis_i::SetWorstElemMeasure(CORBA::Short val )
CORBA::Short NETGENPlugin_Hypothesis_i::GetWorstElemMeasure() CORBA::Short NETGENPlugin_Hypothesis_i::GetWorstElemMeasure()
{ {
return GetImpl()->GetWorstElemMeasure(); return (CORBA::Short) GetImpl()->GetWorstElemMeasure();
} }
//======================================================================= //=======================================================================

View File

@ -1162,7 +1162,7 @@ bool NETGENPlugin_Mesher::FillNgMesh(netgen::OCCGeometry& occgeom,
const vector<UVPtStruct>& points = fSide.GetUVPtStruct(); const vector<UVPtStruct>& points = fSide.GetUVPtStruct();
if ( points.empty() ) if ( points.empty() )
return false; // invalid node params? return false; // invalid node params?
int i, nbSeg = fSide.NbSegments(); smIdType i, nbSeg = fSide.NbSegments();
// remember EDGEs of fSide to treat only once // remember EDGEs of fSide to treat only once
for ( int iE = 0; iE < fSide.NbEdges(); ++iE ) for ( int iE = 0; iE < fSide.NbEdges(); ++iE )
@ -2202,7 +2202,7 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh,
// ---------------------------- // ----------------------------
// Check wires and count nodes // Check wires and count nodes
// ---------------------------- // ----------------------------
int nbNodes = 0; smIdType nbNodes = 0;
for ( size_t iW = 0; iW < wires.size(); ++iW ) for ( size_t iW = 0; iW < wires.size(); ++iW )
{ {
StdMeshers_FaceSidePtr wire = wires[ iW ]; StdMeshers_FaceSidePtr wire = wires[ iW ];
@ -2259,7 +2259,7 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh,
{ {
StdMeshers_FaceSidePtr wire = wires[ iW ]; StdMeshers_FaceSidePtr wire = wires[ iW ];
const vector<UVPtStruct>& uvPtVec = wire->GetUVPtStruct(); const vector<UVPtStruct>& uvPtVec = wire->GetUVPtStruct();
const int nbSegments = wire->NbPoints() - 1; const smIdType nbSegments = wire->NbPoints() - 1;
// assure the 1st node to be in node2ngID, which is needed to correctly // assure the 1st node to be in node2ngID, which is needed to correctly
// "close chain of segments" (see below) in case if the 1st node is not // "close chain of segments" (see below) in case if the 1st node is not
@ -2351,8 +2351,8 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh,
SMESH_TNodeXYZ np1( n ), np2( uvPtVec[ i+1 ].node ); SMESH_TNodeXYZ np1( n ), np2( uvPtVec[ i+1 ].node );
// get an average size of adjacent segments to avoid sharp change of // get an average size of adjacent segments to avoid sharp change of
// element size (regression on issue 0020452, note 0010898) // element size (regression on issue 0020452, note 0010898)
int iPrev = SMESH_MesherHelper::WrapIndex( i-1, nbSegments ); int iPrev = SMESH_MesherHelper::WrapIndex( i-1, (int) nbSegments );
int iNext = SMESH_MesherHelper::WrapIndex( i+1, nbSegments ); int iNext = SMESH_MesherHelper::WrapIndex( i+1, (int) nbSegments );
double sumH = segLen[ iPrev ] + segLen[ i ] + segLen[ iNext ]; double sumH = segLen[ iPrev ] + segLen[ i ] + segLen[ iNext ];
int nbSeg = ( int( segLen[ iPrev ] > sumH / 100.) + int nbSeg = ( int( segLen[ iPrev ] > sumH / 100.) +
int( segLen[ i ] > sumH / 100.) + int( segLen[ i ] > sumH / 100.) +
@ -2465,14 +2465,14 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo,
if ( quadHelper && !quadHelper->GetIsQuadratic() && quadHelper->GetTLinkNodeMap().empty() ) if ( quadHelper && !quadHelper->GetIsQuadratic() && quadHelper->GetTLinkNodeMap().empty() )
quadHelper = 0; quadHelper = 0;
int i, nbInitNod = initState._nbNodes; int ngID, nbInitNod = initState._nbNodes;
if ( initState._elementsRemoved ) if ( initState._elementsRemoved )
{ {
// PAL23427. Update nodeVec to track removal of netgen free points as a result // PAL23427. Update nodeVec to track removal of netgen free points as a result
// of removal of faces in FillNgMesh() in the case of a shrunk sub-mesh // of removal of faces in FillNgMesh() in the case of a shrunk sub-mesh
int ngID, nodeVecSize = nodeVec.size(); size_t i, nodeVecSize = nodeVec.size();
const double eps = std::numeric_limits<double>::min(); const double eps = std::numeric_limits<double>::min();
for ( ngID = i = 1; i < nodeVecSize; ++ngID, ++i ) for ( i = ngID = 1; i < nodeVecSize; ++ngID, ++i )
{ {
gp_Pnt ngPnt( NGPOINT_COORDS( ngMesh.Point( ngID ))); gp_Pnt ngPnt( NGPOINT_COORDS( ngMesh.Point( ngID )));
gp_Pnt node ( SMESH_NodeXYZ (nodeVec_ACCESS(i) )); gp_Pnt node ( SMESH_NodeXYZ (nodeVec_ACCESS(i) ));
@ -2494,7 +2494,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo,
if ( nbNod > nbInitNod ) if ( nbNod > nbInitNod )
nodeVec.resize( nbNod + 1 ); nodeVec.resize( nbNod + 1 );
for ( i = nbInitNod+1; i <= nbNod; ++i ) for ( int i = nbInitNod+1; i <= nbNod; ++i )
{ {
const netgen::MeshPoint& ngPoint = ngMesh.Point(i); const netgen::MeshPoint& ngPoint = ngMesh.Point(i);
SMDS_MeshNode* node = NULL; SMDS_MeshNode* node = NULL;
@ -2529,7 +2529,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo,
// ------------------------------------------- // -------------------------------------------
int nbInitSeg = initState._nbSegments; int nbInitSeg = initState._nbSegments;
for (i = nbInitSeg+1; i <= nbSeg; ++i ) for ( int i = nbInitSeg+1; i <= nbSeg; ++i )
{ {
const netgen::Segment& seg = ngMesh.LineSegment(i); const netgen::Segment& seg = ngMesh.LineSegment(i);
TopoDS_Edge aEdge; TopoDS_Edge aEdge;
@ -2611,7 +2611,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo,
ngMesh.AddFaceDescriptor (netgen::FaceDescriptor(quadFaceID, /*solid1=*/0, /*solid2=*/0, 0)); ngMesh.AddFaceDescriptor (netgen::FaceDescriptor(quadFaceID, /*solid1=*/0, /*solid2=*/0, 0));
vector<const SMDS_MeshNode*> nodes; vector<const SMDS_MeshNode*> nodes;
for (i = nbInitFac+1; i <= nbFac; ++i ) for ( int i = nbInitFac+1; i <= nbFac; ++i )
{ {
const netgen::Element2d& elem = ngMesh.SurfaceElement(i); const netgen::Element2d& elem = ngMesh.SurfaceElement(i);
const int aGeomFaceInd = elem.GetIndex(); const int aGeomFaceInd = elem.GetIndex();
@ -2692,7 +2692,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo,
// Create tetrahedra // Create tetrahedra
// ------------------ // ------------------
for ( i = 1; i <= nbVol; ++i ) for ( int i = 1; i <= nbVol; ++i )
{ {
const netgen::Element& elem = ngMesh.VolumeElement(i); const netgen::Element& elem = ngMesh.VolumeElement(i);
int aSolidInd = elem.GetIndex(); int aSolidInd = elem.GetIndex();
@ -2957,7 +2957,7 @@ bool NETGENPlugin_Mesher::Compute()
{ {
// Pass 1D simple parameters to NETGEN // Pass 1D simple parameters to NETGEN
// -------------------------------- // --------------------------------
int nbSeg = _simpleHyp->GetNumberOfSegments(); double nbSeg = (double) _simpleHyp->GetNumberOfSegments();
double segSize = _simpleHyp->GetLocalLength(); double segSize = _simpleHyp->GetLocalLength();
for ( int iE = 1; iE <= occgeo.emap.Extent(); ++iE ) for ( int iE = 1; iE <= occgeo.emap.Extent(); ++iE )
{ {
@ -3184,7 +3184,7 @@ bool NETGENPlugin_Mesher::Compute()
FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment, &quadHelper ); FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment, &quadHelper );
// compute prismatic boundary volumes // compute prismatic boundary volumes
int nbQuad = _mesh->NbQuadrangles(); smIdType nbQuad = _mesh->NbQuadrangles();
SMESH_ProxyMesh::Ptr viscousMesh; SMESH_ProxyMesh::Ptr viscousMesh;
if ( _viscousLayersHyp ) if ( _viscousLayersHyp )
{ {
@ -3442,9 +3442,9 @@ bool NETGENPlugin_Mesher::Compute()
bool smComputed = nbVol && !sm->IsEmpty(); bool smComputed = nbVol && !sm->IsEmpty();
if ( smComputed && internals.hasInternalVertexInSolid( sm->GetId() )) if ( smComputed && internals.hasInternalVertexInSolid( sm->GetId() ))
{ {
int nbIntV = internals.getSolidsWithVertices().find( sm->GetId() )->second.size(); size_t nbIntV = internals.getSolidsWithVertices().find( sm->GetId() )->second.size();
SMESHDS_SubMesh* smDS = sm->GetSubMeshDS(); SMESHDS_SubMesh* smDS = sm->GetSubMeshDS();
smComputed = ( smDS->NbElements() > 0 || smDS->NbNodes() > nbIntV ); smComputed = ( smDS->NbElements() > 0 || smDS->NbNodes() > (smIdType) nbIntV );
} }
SMESH_ComputeErrorPtr& smError = sm->GetComputeError(); SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
if ( !smComputed && ( !smError || smError->IsOK() )) if ( !smComputed && ( !smError || smError->IsOK() ))
@ -3552,7 +3552,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
// } // }
// calculate total nb of segments and length of edges // calculate total nb of segments and length of edges
double fullLen = 0.0; double fullLen = 0.0;
int fullNbSeg = 0; smIdType fullNbSeg = 0;
int entity = mparams.secondorder > 0 ? SMDSEntity_Quad_Edge : SMDSEntity_Edge; int entity = mparams.secondorder > 0 ? SMDSEntity_Quad_Edge : SMDSEntity_Edge;
TopTools_DataMapOfShapeInteger Edge2NbSeg; TopTools_DataMapOfShapeInteger Edge2NbSeg;
for (TopExp_Explorer exp(_shape, TopAbs_EDGE); exp.More(); exp.Next()) for (TopExp_Explorer exp(_shape, TopAbs_EDGE); exp.More(); exp.Next())
@ -3564,7 +3564,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
double aLen = SMESH_Algo::EdgeLength(E); double aLen = SMESH_Algo::EdgeLength(E);
fullLen += aLen; fullLen += aLen;
vector<int>& aVec = aResMap[_mesh->GetSubMesh(E)]; vector<smIdType>& aVec = aResMap[_mesh->GetSubMesh(E)];
if ( aVec.empty() ) if ( aVec.empty() )
aVec.resize( SMDSEntity_Last, 0); aVec.resize( SMDSEntity_Last, 0);
else else
@ -3581,7 +3581,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
int aGeomEdgeInd = seg.epgeominfo[0].edgenr; int aGeomEdgeInd = seg.epgeominfo[0].edgenr;
if (aGeomEdgeInd > 0 && aGeomEdgeInd <= occgeo.emap.Extent()) if (aGeomEdgeInd > 0 && aGeomEdgeInd <= occgeo.emap.Extent())
{ {
vector<int>& aVec = aResMap[_mesh->GetSubMesh(occgeo.emap(aGeomEdgeInd))]; vector<smIdType>& aVec = aResMap[_mesh->GetSubMesh(occgeo.emap(aGeomEdgeInd))];
aVec[ entity ]++; aVec[ entity ]++;
} }
} }
@ -3589,12 +3589,12 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
TopTools_DataMapIteratorOfDataMapOfShapeInteger Edge2NbSegIt(Edge2NbSeg); TopTools_DataMapIteratorOfDataMapOfShapeInteger Edge2NbSegIt(Edge2NbSeg);
for (; Edge2NbSegIt.More(); Edge2NbSegIt.Next()) for (; Edge2NbSegIt.More(); Edge2NbSegIt.Next())
{ {
vector<int>& aVec = aResMap[_mesh->GetSubMesh(Edge2NbSegIt.Key())]; vector<smIdType>& aVec = aResMap[_mesh->GetSubMesh(Edge2NbSegIt.Key())];
if ( aVec[ entity ] > 1 && aVec[ SMDSEntity_Node ] == 0 ) if ( aVec[ entity ] > 1 && aVec[ SMDSEntity_Node ] == 0 )
aVec[SMDSEntity_Node] = mparams.secondorder > 0 ? 2*aVec[ entity ]-1 : aVec[ entity ]-1; aVec[SMDSEntity_Node] = mparams.secondorder > 0 ? 2*aVec[ entity ]-1 : aVec[ entity ]-1;
fullNbSeg += aVec[ entity ]; fullNbSeg += aVec[ entity ];
Edge2NbSeg( Edge2NbSegIt.Key() ) = aVec[ entity ]; Edge2NbSeg( Edge2NbSegIt.Key() ) = (int) aVec[ entity ];
} }
if ( fullNbSeg == 0 ) if ( fullNbSeg == 0 )
return false; return false;
@ -3610,12 +3610,12 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
} }
else { else {
// length from edges // length from edges
mparams.maxh = fullLen/fullNbSeg; mparams.maxh = fullLen / double( fullNbSeg );
mparams.grading = 0.2; // slow size growth mparams.grading = 0.2; // slow size growth
} }
} }
mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 ); mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 );
mparams.maxh = min( mparams.maxh, fullLen/fullNbSeg * (1. + mparams.grading)); mparams.maxh = min( mparams.maxh, fullLen / double( fullNbSeg ) * (1. + mparams.grading));
for (TopExp_Explorer exp(_shape, TopAbs_FACE); exp.More(); exp.Next()) for (TopExp_Explorer exp(_shape, TopAbs_FACE); exp.More(); exp.Next())
{ {
@ -3636,7 +3636,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
int nbFaces = tooManyElems ? hugeNb : int( 4*anArea / (mparams.maxh*mparams.maxh*sqrt(3.))); int nbFaces = tooManyElems ? hugeNb : int( 4*anArea / (mparams.maxh*mparams.maxh*sqrt(3.)));
int nbNodes = tooManyElems ? hugeNb : (( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 ); int nbNodes = tooManyElems ? hugeNb : (( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
vector<int> aVec(SMDSEntity_Last, 0); vector<smIdType> aVec(SMDSEntity_Last, 0);
if( mparams.secondorder > 0 ) { if( mparams.secondorder > 0 ) {
int nb1d_in = (nbFaces*3 - nb1d) / 2; int nb1d_in = (nbFaces*3 - nb1d) / 2;
aVec[SMDSEntity_Node] = nbNodes + nb1d_in; aVec[SMDSEntity_Node] = nbNodes + nb1d_in;
@ -3666,7 +3666,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
// using previous length from faces // using previous length from faces
} }
mparams.grading = 0.4; mparams.grading = 0.4;
mparams.maxh = min( mparams.maxh, fullLen/fullNbSeg * (1. + mparams.grading)); mparams.maxh = min( mparams.maxh, fullLen / double( fullNbSeg ) * (1. + mparams.grading));
} }
GProp_GProps G; GProp_GProps G;
BRepGProp::VolumeProperties(_shape,G); BRepGProp::VolumeProperties(_shape,G);
@ -3675,7 +3675,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
tooManyElems = tooManyElems || ( aVolume/hugeNb > tetrVol ); tooManyElems = tooManyElems || ( aVolume/hugeNb > tetrVol );
int nbVols = tooManyElems ? hugeNb : int(aVolume/tetrVol); int nbVols = tooManyElems ? hugeNb : int(aVolume/tetrVol);
int nb1d_in = int(( nbVols*6 - fullNbSeg ) / 6 ); int nb1d_in = int(( nbVols*6 - fullNbSeg ) / 6 );
vector<int> aVec(SMDSEntity_Last, 0 ); vector<smIdType> aVec(SMDSEntity_Last, 0 );
if ( tooManyElems ) // avoid FPE if ( tooManyElems ) // avoid FPE
{ {
aVec[SMDSEntity_Node] = hugeNb; aVec[SMDSEntity_Node] = hugeNb;
@ -3787,8 +3787,8 @@ NETGENPlugin_Mesher::ReadErrors(const vector<const SMDS_MeshNode* >& nodeVec)
vector<int> two(2); vector<int> two(2);
vector<int> three1(3), three2(3); vector<int> three1(3), three2(3);
const char* badEdgeStr = " multiple times in surface mesh"; const char* badEdgeStr = " multiple times in surface mesh";
const int badEdgeStrLen = strlen( badEdgeStr ); const int badEdgeStrLen = (int) strlen( badEdgeStr );
const int nbNodes = nodeVec.size(); const int nbNodes = (int) nodeVec.size();
while( !file.eof() ) while( !file.eof() )
{ {
@ -3798,7 +3798,7 @@ NETGENPlugin_Mesher::ReadErrors(const vector<const SMDS_MeshNode* >& nodeVec)
two[0] < nbNodes && two[1] < nbNodes ) two[0] < nbNodes && two[1] < nbNodes )
{ {
err->myBadElements.push_back( new SMDS_LinearEdge( nodeVec[ two[0]], nodeVec[ two[1]] )); err->myBadElements.push_back( new SMDS_LinearEdge( nodeVec[ two[0]], nodeVec[ two[1]] ));
file += badEdgeStrLen; file += (int) badEdgeStrLen;
} }
else if ( strncmp( file, "Intersecting: ", 14 ) == 0 ) else if ( strncmp( file, "Intersecting: ", 14 ) == 0 )
{ {

View File

@ -356,7 +356,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, faceErr, &helper, proxyMesh ); StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, faceErr, &helper, proxyMesh );
if ( faceErr && !faceErr->IsOK() ) if ( faceErr && !faceErr->IsOK() )
continue; continue;
int nbWires = wires.size(); size_t nbWires = wires.size();
if ( nbWires == 0 ) if ( nbWires == 0 )
{ {
faceErr.reset faceErr.reset
@ -382,21 +382,21 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
if (_hypLengthFromEdges ) if (_hypLengthFromEdges )
{ {
// compute edgeLength as an average segment length // compute edgeLength as an average segment length
int nbSegments = 0; smIdType nbSegments = 0;
for ( int iW = 0; iW < nbWires; ++iW ) for ( size_t iW = 0; iW < nbWires; ++iW )
{ {
edgeLength += wires[ iW ]->Length(); edgeLength += wires[ iW ]->Length();
nbSegments += wires[ iW ]->NbSegments(); nbSegments += wires[ iW ]->NbSegments();
} }
if ( nbSegments ) if ( nbSegments )
edgeLength /= nbSegments; edgeLength /= double( nbSegments );
netgen::mparam.maxh = edgeLength; netgen::mparam.maxh = edgeLength;
} }
else if ( isDefaultHyp ) else if ( isDefaultHyp )
{ {
// set edgeLength by a longest segment // set edgeLength by a longest segment
double maxSeg2 = 0; double maxSeg2 = 0;
for ( int iW = 0; iW < nbWires; ++iW ) for ( size_t iW = 0; iW < nbWires; ++iW )
{ {
const UVPtStructVec& points = wires[ iW ]->GetUVPtStruct(); const UVPtStructVec& points = wires[ iW ]->GetUVPtStruct();
if ( points.empty() ) if ( points.empty() )
@ -548,7 +548,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
int nbNodes = ngMesh->GetNP(); int nbNodes = ngMesh->GetNP();
int nbFaces = ngMesh->GetNSE(); int nbFaces = ngMesh->GetNSE();
int nbInputNodes = nodeVec.size()-1; int nbInputNodes = (int) nodeVec.size()-1;
nodeVec.resize( nbNodes+1, 0 ); nodeVec.resize( nbNodes+1, 0 );
// add nodes // add nodes
@ -646,7 +646,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
return false; return false;
// collect info from edges // collect info from edges
int nb0d = 0, nb1d = 0; smIdType nb0d = 0, nb1d = 0;
bool IsQuadratic = false; bool IsQuadratic = false;
bool IsFirst = true; bool IsFirst = true;
double fullLen = 0.0; double fullLen = 0.0;
@ -664,9 +664,9 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this)); smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
return false; return false;
} }
std::vector<int> aVec = (*anIt).second; std::vector<smIdType> aVec = (*anIt).second;
nb0d += aVec[SMDSEntity_Node]; nb0d += aVec[SMDSEntity_Node];
nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); nb1d += std::max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
double aLen = SMESH_Algo::EdgeLength(E); double aLen = SMESH_Algo::EdgeLength(E);
fullLen += aLen; fullLen += aLen;
if(IsFirst) { if(IsFirst) {
@ -680,7 +680,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
double ELen = 0; double ELen = 0;
if (( _hypLengthFromEdges ) || ( !_hypLengthFromEdges && !_hypMaxElementArea )) { if (( _hypLengthFromEdges ) || ( !_hypLengthFromEdges && !_hypMaxElementArea )) {
if ( nb1d > 0 ) if ( nb1d > 0 )
ELen = fullLen / nb1d; ELen = fullLen / double( nb1d );
} }
if ( _hypMaxElementArea ) { if ( _hypMaxElementArea ) {
double maxArea = _hypMaxElementArea->GetMaxArea(); double maxArea = _hypMaxElementArea->GetMaxArea();
@ -698,10 +698,10 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated.\nToo small element length",this)); smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated.\nToo small element length",this));
return false; return false;
} }
int nbFaces = (int) ( anArea / ( ELen*ELen*sqrt(3.) / 4 ) ); smIdType nbFaces = (smIdType) ( anArea / ( ELen*ELen*sqrt(3.) / 4 ) );
int nbNodes = (int) ( ( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 ); smIdType nbNodes = (smIdType) ( ( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
std::vector<int> aVec(SMDSEntity_Last); std::vector<smIdType> aVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0; for(smIdType i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
if( IsQuadratic ) { if( IsQuadratic ) {
aVec[SMDSEntity_Node] = nbNodes; aVec[SMDSEntity_Node] = nbNodes;
aVec[SMDSEntity_Quad_Triangle] = nbFaces; aVec[SMDSEntity_Quad_Triangle] = nbFaces;

View File

@ -728,7 +728,7 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap) MapShapeNbElems& aResMap)
{ {
int nbtri = 0, nbqua = 0; smIdType nbtri = 0, nbqua = 0;
double fullArea = 0.0; double fullArea = 0.0;
for (TopExp_Explorer expF(aShape, TopAbs_FACE); expF.More(); expF.Next()) { for (TopExp_Explorer expF(aShape, TopAbs_FACE); expF.More(); expF.Next()) {
TopoDS_Face F = TopoDS::Face( expF.Current() ); TopoDS_Face F = TopoDS::Face( expF.Current() );
@ -739,9 +739,9 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh,
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this)); smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
return false; return false;
} }
std::vector<int> aVec = (*anIt).second; std::vector<smIdType> aVec = (*anIt).second;
nbtri += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]); nbtri += std::max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
nbqua += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]); nbqua += std::max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
GProp_GProps G; GProp_GProps G;
BRepGProp::SurfaceProperties(F,G); BRepGProp::SurfaceProperties(F,G);
double anArea = G.Mass(); double anArea = G.Mass();
@ -749,7 +749,7 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh,
} }
// collect info from edges // collect info from edges
int nb0d_e = 0, nb1d_e = 0; smIdType nb0d_e = 0, nb1d_e = 0;
bool IsQuadratic = false; bool IsQuadratic = false;
bool IsFirst = true; bool IsFirst = true;
TopTools_MapOfShape tmpMap; TopTools_MapOfShape tmpMap;
@ -766,9 +766,9 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh,
"Submesh can not be evaluated",this)); "Submesh can not be evaluated",this));
return false; return false;
} }
std::vector<int> aVec = (*anIt).second; std::vector<smIdType> aVec = (*anIt).second;
nb0d_e += aVec[SMDSEntity_Node]; nb0d_e += aVec[SMDSEntity_Node];
nb1d_e += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]); nb1d_e += std::max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
if(IsFirst) { if(IsFirst) {
IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]); IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
IsFirst = false; IsFirst = false;
@ -776,7 +776,7 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh,
} }
tmpMap.Clear(); tmpMap.Clear();
double ELen_face = sqrt(2.* ( fullArea/(nbtri+nbqua*2) ) / sqrt(3.0) ); double ELen_face = sqrt(2.* ( fullArea/double(nbtri+nbqua*2) ) / sqrt(3.0) );
double ELen_vol = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. ); double ELen_vol = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. );
double ELen = Min(ELen_vol,ELen_face*2); double ELen = Min(ELen_vol,ELen_face*2);
@ -785,11 +785,11 @@ bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh,
double aVolume = G.Mass(); double aVolume = G.Mass();
double tetrVol = 0.1179*ELen*ELen*ELen; double tetrVol = 0.1179*ELen*ELen*ELen;
double CoeffQuality = 0.9; double CoeffQuality = 0.9;
int nbVols = int( aVolume/tetrVol/CoeffQuality ); smIdType nbVols = (smIdType)( aVolume/tetrVol/CoeffQuality );
int nb1d_f = (nbtri*3 + nbqua*4 - nb1d_e) / 2; smIdType nb1d_f = (nbtri*3 + nbqua*4 - nb1d_e) / 2;
int nb1d_in = (nbVols*6 - nb1d_e - nb1d_f ) / 5; smIdType nb1d_in = (nbVols*6 - nb1d_e - nb1d_f ) / 5;
std::vector<int> aVec(SMDSEntity_Last); std::vector<smIdType> aVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0; for(smIdType i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
if( IsQuadratic ) { if( IsQuadratic ) {
aVec[SMDSEntity_Node] = nb1d_in/6 + 1 + nb1d_in; aVec[SMDSEntity_Node] = nb1d_in/6 + 1 + nb1d_in;
aVec[SMDSEntity_Quad_Tetra] = nbVols - nbqua*2; aVec[SMDSEntity_Quad_Tetra] = nbVols - nbqua*2;

View File

@ -141,7 +141,7 @@ namespace
{ {
// define tolerance // define tolerance
double tol, len, sumLen = 0, minLen = 1e100; double tol, len, sumLen = 0, minLen = 1e100;
int nbSeg = 0; size_t nbSeg = 0;
for ( size_t i = 0; i < holes.size(); ++i ) for ( size_t i = 0; i < holes.size(); ++i )
{ {
nbSeg += holes[i].size(); nbSeg += holes[i].size();
@ -155,7 +155,7 @@ namespace
p1 = p2; p1 = p2;
} }
} }
double avgLen = sumLen / nbSeg; double avgLen = sumLen / double( nbSeg );
if ( minLen > 1e-5 * avgLen ) if ( minLen > 1e-5 * avgLen )
tol = 0.1 * minLen; // minLen is not degenerate tol = 0.1 * minLen; // minLen is not degenerate
else else
@ -780,7 +780,7 @@ bool NETGENPlugin_Remesher_2D::Compute(SMESH_Mesh& theMesh,
// find existing groups // find existing groups
const char* theNamePrefix = "Surface_"; const char* theNamePrefix = "Surface_";
const int theNamePrefixLen = strlen( theNamePrefix ); const size_t theNamePrefixLen = strlen( theNamePrefix );
std::vector< SMESHDS_Group* > groups; std::vector< SMESHDS_Group* > groups;
if ( hyp && hyp->GetMakeGroupsOfSurfaces() ) if ( hyp && hyp->GetMakeGroupsOfSurfaces() )
{ {

View File

@ -199,7 +199,7 @@ bool NETGENPlugin_SimpleHypothesis_2D::SetParametersByMesh(const SMESH_Mesh* t
const TopoDS_Shape& theShape) const TopoDS_Shape& theShape)
{ {
// Find out nb of segments. // Find out nb of segments.
int nbSeg = 0, nbEdges = 0; smIdType nbSeg = 0, nbEdges = 0;
TopExp_Explorer exp( theShape, TopAbs_EDGE ); TopExp_Explorer exp( theShape, TopAbs_EDGE );
for ( ; exp.More(); exp.Next() ) { for ( ; exp.More(); exp.Next() ) {
SMESH_subMesh* sm = theMesh->GetSubMeshContaining( exp.Current() ); SMESH_subMesh* sm = theMesh->GetSubMeshContaining( exp.Current() );

View File

@ -29,7 +29,7 @@
#include "NETGENPlugin_Defs.hxx" #include "NETGENPlugin_Defs.hxx"
#include "SMESH_Hypothesis.hxx" #include "SMESH_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx" #include "smIdType.hxx"
// Simplified parameters of NETGEN // Simplified parameters of NETGEN
// //
@ -48,7 +48,7 @@ public:
* Returns <number of segments> value. * Returns <number of segments> value.
* Can be zero in case if LocalLength() has been set * Can be zero in case if LocalLength() has been set
*/ */
int GetNumberOfSegments() const { return _nbSegments; } smIdType GetNumberOfSegments() const { return _nbSegments; }
/*! /*!
* Sets <segment length> value * Sets <segment length> value
@ -104,7 +104,7 @@ public:
virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0); virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
private: private:
int _nbSegments; smIdType _nbSegments;
double _segmentLength, _area; double _segmentLength, _area;
bool _allowQuad; bool _allowQuad;
}; };

View File

@ -71,7 +71,7 @@ NETGENPlugin_SimpleHypothesis_2D_i::~NETGENPlugin_SimpleHypothesis_2D_i()
* NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments * NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments
*/ */
//============================================================================= //=============================================================================
void NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments(CORBA::Short nb) void NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments(CORBA::Long nb)
{ {
ASSERT(myBaseImpl); ASSERT(myBaseImpl);
try { try {
@ -88,10 +88,10 @@ void NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments(CORBA::Short nb)
* NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments() * NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments()
*/ */
//============================================================================= //=============================================================================
CORBA::Short NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments() CORBA::Long NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments()
{ {
ASSERT(myBaseImpl); ASSERT(myBaseImpl);
return this->GetImpl()->GetNumberOfSegments(); return (CORBA::Long) this->GetImpl()->GetNumberOfSegments();
} }
//================================================================================ //================================================================================

View File

@ -49,8 +49,8 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_SimpleHypothesis_2D_i:
// Destructor // Destructor
virtual ~NETGENPlugin_SimpleHypothesis_2D_i(); virtual ~NETGENPlugin_SimpleHypothesis_2D_i();
void SetNumberOfSegments(CORBA::Short nb); void SetNumberOfSegments(CORBA::Long nb);
CORBA::Short GetNumberOfSegments(); CORBA::Long GetNumberOfSegments();
void SetLocalLength(CORBA::Double segmentLength); void SetLocalLength(CORBA::Double segmentLength);
CORBA::Double GetLocalLength(); CORBA::Double GetLocalLength();