From: nge Date: Mon, 20 Jul 2009 12:37:08 +0000 (+0000) Subject: * Structural change of GHS3DSizeMapVertex from struct to vector: X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d7167a133b3e6c98482cbdc8d0b9f759f819450c;p=plugins%2Fghs3dplugin.git * Structural change of GHS3DSizeMapVertex from struct to vector: Before: typedef struct { double x; double y; double z; } GHS3DSizeMapVertex; Now: typedef std::vector GHS3DSizeMapVertex; * Adding missing std:: * Minor corrections --- diff --git a/src/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin_GHS3D.cxx index 67faa66..b972040 100644 --- a/src/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin_GHS3D.cxx @@ -76,7 +76,7 @@ using namespace std; #ifdef _DEBUG_ #define DUMP(txt) \ -// cout << txt +// std::cout << txt #else #define DUMP(txt) #endif @@ -191,7 +191,7 @@ static TopoDS_Shape findShape(const SMDS_MeshNode *aNode[], static char* readMapIntLine(char* ptr, int tab[]) { long int intVal; - cout << endl; + std::cout << std::endl; for ( int i=0; i<17; i++ ) { intVal = strtol(ptr, &ptr, 10); @@ -428,7 +428,6 @@ static bool writePoints (ofstream & theFile, } std::cout << std::endl; std::cout << "Start writing in 'points' file ..." << std::endl; -// theFile << space << nbNodes - nbEnforcedVerteces << std::endl; theFile << space << nbNodes << std::endl; // Loop from 1 to NB_NODES @@ -455,9 +454,9 @@ static bool writePoints (ofstream & theFile, GHS3DPlugin_Hypothesis::TSizeMapVertexValues::const_iterator vertexIt; const TopoDS_Shape shapeToMesh = theMesh->ShapeToMesh(); for(vertexIt = theEnforcedVerteces.begin() ; vertexIt != theEnforcedVerteces.end() ; ++vertexIt) { - double x = vertexIt->first->x; - double y = vertexIt->first->y; - double z = vertexIt->first->z; + double x = vertexIt->first[0]; + double y = vertexIt->first[1]; + double z = vertexIt->first[2]; // Test if point is inside shape to mesh gp_Pnt myPoint(x,y,z); BRepClass3d_SolidClassifier scl(shapeToMesh); @@ -494,7 +493,6 @@ static bool writePoints (ofstream & theFile, const vector & theNodeByGhs3dId, GHS3DPlugin_Hypothesis::TSizeMapVertexValues & theEnforcedVerteces) { - std::cout << "writePoints(ofstream &,SMESHDS_Mesh *,const vector &,GHS3DPlugin_Hypothesis::TSizeMapVertexValues &)" << std::endl; // record structure: // // NB_NODES @@ -514,10 +512,10 @@ static bool writePoints (ofstream & theFile, const SMDS_MeshNode* node; // NB_NODES - cout << endl; - cout << "The initial 2D mesh contains :" << endl; - cout << " " << nbNodes << " nodes" << endl; - cout << " " << nbEnforcedVerteces << " enforced vertices" << endl; + std::cout << std::endl; + std::cout << "The initial 2D mesh contains :" << std::endl; + std::cout << " " << nbNodes << " nodes" << std::endl; + std::cout << " " << nbEnforcedVerteces << " enforced vertices" << std::endl; std::cout << std::endl; std::cout << "Start writing in 'points' file ..." << std::endl; theFile << space << nbNodes << std::endl; @@ -537,26 +535,37 @@ static bool writePoints (ofstream & theFile, << space << node->Z() << space << dummyint; - theFile << endl; + theFile << std::endl; } // Iterate over the enforced verteces GHS3DPlugin_Hypothesis::TSizeMapVertexValues::const_iterator vertexIt; + const TopoDS_Shape shapeToMesh = theMesh->ShapeToMesh(); for(vertexIt = theEnforcedVerteces.begin() ; vertexIt != theEnforcedVerteces.end() ; ++vertexIt) { - std::cout << "Adding enforced vertex (" << vertexIt->first->x << "," << vertexIt->first->y <<"," << vertexIt->first->z << ") = " << vertexIt->second << std::endl; - - // X Y Z PHY_SIZE DUMMY_INT - theFile - << space << vertexIt->first->x - << space << vertexIt->first->y - << space << vertexIt->first->z - << space << vertexIt->second - << space << dummyint; + double x = vertexIt->first[0]; + double y = vertexIt->first[1]; + double z = vertexIt->first[2]; + // Test if point is inside shape to mesh + gp_Pnt myPoint(x,y,z); + BRepClass3d_SolidClassifier scl(shapeToMesh); + scl.Perform(myPoint, 1e-7); + TopAbs_State result = scl.State(); + if ( result == TopAbs_IN ) { + std::cout << "Adding enforced vertex (" << x << "," << y <<"," << z << ") = " << vertexIt->second << std::endl; - theFile << std::endl; + // X Y Z PHY_SIZE DUMMY_INT + theFile + << space << x + << space << y + << space << z + << space << vertexIt->second + << space << dummyint; + + theFile << std::endl; + } } - std::cout << endl; + std::cout << std::endl; std::cout << "End writing in 'points' file." << std::endl; return true; @@ -782,7 +791,7 @@ static bool readResultFile(const int fileOpen, OCC_CATCH_SIGNALS; tabID[i] = findShapeID( theMesh, n1, n2, n3, toMeshHoles ); #ifdef _DEBUG_ - cout << i+1 << " subdomain: findShapeID() returns " << tabID[i] << endl; + std::cout << i+1 << " subdomain: findShapeID() returns " << tabID[i] << std::endl; #endif } catch ( Standard_Failure ) { } catch (...) {} @@ -866,7 +875,7 @@ static bool readResultFile(const int fileOpen, } if ( nbElems ) - cout << nbElems << " tetrahedrons have been associated to " << nbShape << " shapes" << endl; + std::cout << nbElems << " tetrahedrons have been associated to " << nbShape << " shapes" << std::endl; munmap(mapPtr, length); close(fileOpen); @@ -879,11 +888,11 @@ static bool readResultFile(const int fileOpen, #ifdef _DEBUG_ if ( shapeIDs.size() != nbShape ) { - cout << "Only " << shapeIDs.size() << " solids of " << nbShape << " found" << endl; + std::cout << "Only " << shapeIDs.size() << " solids of " << nbShape << " found" << std::endl; for (int i=0; iShapeToIndex( tabShape[i] ); if ( shapeIDs.find( shapeID ) == shapeIDs.end() ) - cout << " Solid #" << shapeID << " not found" << endl; + std::cout << " Solid #" << shapeID << " not found" << std::endl; } } #endif @@ -979,7 +988,7 @@ static bool readResultFile(const int fileOpen, theMeshDS->SetMeshElementOnShape( aTet, shapeID ); } if ( nbElems ) - cout << nbElems << " tetrahedrons have been associated to " << nbTriangle << " shapes" << endl; + std::cout << nbElems << " tetrahedrons have been associated to " << nbTriangle << " shapes" << std::endl; munmap(mapPtr, length); close(fileOpen); @@ -1093,14 +1102,14 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, cmd += TCollection_AsciiString(" -f ") + aGenericName; // file to read cmd += TCollection_AsciiString(" 1>" ) + aLogFileName; // dump into file - cout << endl; - cout << "Ghs3d execution..." << endl; - cout << cmd << endl; + std::cout << std::endl; + std::cout << "Ghs3d execution..." << std::endl; + std::cout << cmd << std::endl; system( cmd.ToCString() ); // run - cout << endl; - cout << "End of Ghs3d execution !" << endl; + std::cout << std::endl; + std::cout << "End of Ghs3d execution !" << std::endl; // -------------- // read a result @@ -1111,9 +1120,9 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, int fileOpen; fileOpen = open( aResultFileName.ToCString(), O_RDONLY); if ( fileOpen < 0 ) { - cout << endl; - cout << "Can't open the " << aResultFileName.ToCString() << " GHS3D output file" << endl; - cout << "Log: " << aLogFileName << endl; + std::cout << std::endl; + std::cout << "Can't open the " << aResultFileName.ToCString() << " GHS3D output file" << std::endl; + std::cout << "Log: " << aLogFileName << std::endl; Ok = false; } else { @@ -1153,11 +1162,11 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, OSD_File( aBadResFileName ).Remove(); OSD_File( aBbResFileName ).Remove(); } - cout << "<" << aResultFileName.ToCString() << "> GHS3D output file "; + std::cout << "<" << aResultFileName.ToCString() << "> GHS3D output file "; if ( !Ok ) - cout << "not "; - cout << "treated !" << endl; - cout << endl; + std::cout << "not "; + std::cout << "treated !" << std::endl; + std::cout << std::endl; _nbShape = 0; // re-initializing _nbShape for the next Compute() method call delete [] tabShape; @@ -1253,10 +1262,10 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, int fileOpen; fileOpen = open( aResultFileName.ToCString(), O_RDONLY); if ( fileOpen < 0 ) { - cout << endl; - cout << "Error when opening the " << aResultFileName.ToCString() << " file" << endl; - cout << "Log: " << aLogFileName << endl; - cout << endl; + std::cout << std::endl; + std::cout << "Error when opening the " << aResultFileName.ToCString() << " file" << std::endl; + std::cout << "Log: " << aLogFileName << std::endl; + std::cout << std::endl; Ok = false; } else { diff --git a/src/GHS3DPlugin_Hypothesis.cxx b/src/GHS3DPlugin_Hypothesis.cxx index 0095c58..55dbd84 100644 --- a/src/GHS3DPlugin_Hypothesis.cxx +++ b/src/GHS3DPlugin_Hypothesis.cxx @@ -142,7 +142,7 @@ GHS3DPlugin_Hypothesis::OptimizationLevel GHS3DPlugin_Hypothesis::GetOptimizatio //function : SetWorkingDirectory //======================================================================= -void GHS3DPlugin_Hypothesis::SetWorkingDirectory(const string& path) +void GHS3DPlugin_Hypothesis::SetWorkingDirectory(const std::string& path) { if ( myWorkingDirectory != path ) { myWorkingDirectory = path; @@ -154,7 +154,7 @@ void GHS3DPlugin_Hypothesis::SetWorkingDirectory(const string& path) //function : GetWorkingDirectory //======================================================================= -string GHS3DPlugin_Hypothesis::GetWorkingDirectory() const +std::string GHS3DPlugin_Hypothesis::GetWorkingDirectory() const { return myWorkingDirectory; } @@ -247,7 +247,7 @@ bool GHS3DPlugin_Hypothesis::GetToUseBoundaryRecoveryVersion() const //function : SetTextOption //======================================================================= -void GHS3DPlugin_Hypothesis::SetTextOption(const string& option) +void GHS3DPlugin_Hypothesis::SetTextOption(const std::string& option) { if ( myTextOption != option ) { myTextOption = option; @@ -259,7 +259,7 @@ void GHS3DPlugin_Hypothesis::SetTextOption(const string& option) //function : GetTextOption //======================================================================= -string GHS3DPlugin_Hypothesis::GetTextOption() const +std::string GHS3DPlugin_Hypothesis::GetTextOption() const { return myTextOption; } @@ -270,22 +270,11 @@ string GHS3DPlugin_Hypothesis::GetTextOption() const void GHS3DPlugin_Hypothesis::SetSizeMapVertex(double x, double y, double z, double size) { - std::cout << "GHS3DPlugin_Hypothesis::SetSizeMapVertex(x,y,z,size)" << std::endl; - bool found = false; - TSizeMapVertexValues::iterator it; - for (it = mySizeMapVerteces.begin() ; it != mySizeMapVerteces.end() ; ++it) - if ((it->first->x == x) and (it->first->y == y) and (it->first->z == z)) { - it->second = size; - found = true; - break; - } - if (not found) { - GHS3DSizeMapVertex* coord = new GHS3DSizeMapVertex; - coord->x = x; - coord->y = y; - coord->z = z; - mySizeMapVerteces[coord] = size; - } + std::vector coord(3); + coord[0] = x; + coord[1] = y; + coord[2] = z; + mySizeMapVerteces[coord] = size; NotifySubMeshesHypothesisModification(); } @@ -296,15 +285,13 @@ void GHS3DPlugin_Hypothesis::SetSizeMapVertex(double x, double y, double z, doub double GHS3DPlugin_Hypothesis::GetSizeMapVertex(double x, double y, double z) throw (std::invalid_argument) { -// double coord[] = {x,y,z}; - TSizeMapVertexValues::const_iterator it; - for (it = mySizeMapVerteces.begin() ; it != mySizeMapVerteces.end() ; ++it) { - if ((it->first->x == x) and (it->first->y == y) and (it->first->z == z)) - return it->second; - } -// if (mySizeMapVerteces.count(coord)>0) -// return mySizeMapVerteces[coord]; - ostringstream msg ; + std::vector coord(3); + coord[0] = x; + coord[1] = y; + coord[2] = z; + if (mySizeMapVerteces.count(coord)>0) + return mySizeMapVerteces[coord]; + std::ostringstream msg ; msg << "No enforced vertex at " << x << ", " << y << ", " << z; throw std::invalid_argument(msg.str()); } @@ -316,22 +303,19 @@ double GHS3DPlugin_Hypothesis::GetSizeMapVertex(double x, double y, double z) void GHS3DPlugin_Hypothesis::RemoveSizeMapVertex(double x, double y, double z) throw (std::invalid_argument) { - TSizeMapVertexValues::const_iterator it; - bool found = false; - for (it = mySizeMapVerteces.begin() ; it != mySizeMapVerteces.end() ; ++it) - if ((it->first->x == x) and (it->first->y == y) and (it->first->z == z)) { - found = true; - break; + std::vector coord(3); + coord[0] = x; + coord[1] = y; + coord[2] = z; + TSizeMapVertexValues::iterator it = mySizeMapVerteces.find(coord); + if (it != mySizeMapVerteces.end()) { + mySizeMapVerteces.erase(it); + NotifySubMeshesHypothesisModification(); + return; } - if (found) { - mySizeMapVerteces.erase(it->first); - NotifySubMeshesHypothesisModification(); - } - else { - ostringstream msg ; + std::ostringstream msg ; msg << "No enforced vertex at " << x << ", " << y << ", " << z; throw std::invalid_argument(msg.str()); - } } //======================================================================= @@ -409,7 +393,7 @@ short GHS3DPlugin_Hypothesis::DefaultOptimizationLevel() //function : DefaultWorkingDirectory //======================================================================= -string GHS3DPlugin_Hypothesis::DefaultWorkingDirectory() +std::string GHS3DPlugin_Hypothesis::DefaultWorkingDirectory() { TCollection_AsciiString aTmpDir; @@ -469,7 +453,6 @@ bool GHS3DPlugin_Hypothesis::DefaultToUseBoundaryRecoveryVersion() GHS3DPlugin_Hypothesis::TSizeMapVertexValues GHS3DPlugin_Hypothesis::DefaultSizeMapVerteces() { - std::cout << "GHS3DPlugin_Hypothesis::DefaultSizeMapVerteces()" << std::endl; return GHS3DPlugin_Hypothesis::TSizeMapVertexValues(); } @@ -478,7 +461,7 @@ GHS3DPlugin_Hypothesis::TSizeMapVertexValues GHS3DPlugin_Hypothesis::DefaultSize //function : SaveTo //======================================================================= -ostream & GHS3DPlugin_Hypothesis::SaveTo(ostream & save) +std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save) { save << (int) myToMeshHoles << " "; save << myMaximumMemory << " "; @@ -489,14 +472,23 @@ ostream & GHS3DPlugin_Hypothesis::SaveTo(ostream & save) save << myVerboseLevel << " "; save << (int)myToCreateNewNodes << " "; save << (int)myToUseBoundaryRecoveryVersion << " "; + save << "__OPTIONS_BEGIN__ "; save << myTextOption << " "; + save << " __OPTIONS_END__ "; -// if (mySizeMapVerteces.size() >= 4) { -// save << "__SIZEMAP_BEGIN__" << " "; -// for (int i=0 ; ifirst[0] << " " + << it->first[1] << " " + << it->first[2] << " " + << it->second << " "; + } + save << "__ENFORCED_VERTECES_END__ "; + } + return save; } @@ -504,87 +496,150 @@ ostream & GHS3DPlugin_Hypothesis::SaveTo(ostream & save) //function : LoadFrom //======================================================================= -istream & GHS3DPlugin_Hypothesis::LoadFrom(istream & load) -{ - bool isOK = true; - int i; - - isOK = (load >> i); - if (isOK) - myToMeshHoles = i; - else - load.clear(ios::badbit | load.rdstate()); - - isOK = (load >> i); - if (isOK) - myMaximumMemory = i; - else - load.clear(ios::badbit | load.rdstate()); - - isOK = (load >> i); - if (isOK) - myInitialMemory = i; - else - load.clear(ios::badbit | load.rdstate()); - - isOK = (load >> i); - if (isOK) - myOptimizationLevel = i; - else - load.clear(ios::badbit | load.rdstate()); - - isOK = (load >> myWorkingDirectory); - if (isOK) { - if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty - myKeepFiles = false; - myWorkingDirectory.clear(); +std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load) +{ + bool isOK = true; + int i; + + isOK = (load >> i); + if (isOK) + myToMeshHoles = i; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + myMaximumMemory = i; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + myInitialMemory = i; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + myOptimizationLevel = i; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> myWorkingDirectory); + if (isOK) { + if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty + myKeepFiles = false; + myWorkingDirectory.clear(); + } + else if ( myWorkingDirectory == "1" ) { + myKeepFiles = true; + myWorkingDirectory.clear(); + } } - else if ( myWorkingDirectory == "1" ) { - myKeepFiles = true; - myWorkingDirectory.clear(); + else + load.clear(ios::badbit | load.rdstate()); + + if ( !myWorkingDirectory.empty() ) { + isOK = (load >> i); + if (isOK) + myKeepFiles = i; + else + load.clear(ios::badbit | load.rdstate()); } - } - else - load.clear(ios::badbit | load.rdstate()); - - if ( !myWorkingDirectory.empty() ) { + isOK = (load >> i); if (isOK) - myKeepFiles = i; + myVerboseLevel = (short) i; else - load.clear(ios::badbit | load.rdstate()); - } + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + myToCreateNewNodes = (bool) i; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + myToUseBoundaryRecoveryVersion = (bool) i; + else + load.clear(ios::badbit | load.rdstate()); + +// isOK = (load >> myTextOption); +// while (isOK) { +// std::string txt; +// if (load >> txt) { +// myTextOption += " "; +// myTextOption += txt; +// } +// else +// isOK = false; +// } +// // else +// // load.clear(ios::badbit | load.rdstate()); + + + std::string separator; + bool hasOptions = false; + bool hasEnforcedVerteces = false; + isOK = (load >> separator); - isOK = (load >> i); - if (isOK) - myVerboseLevel = (short) i; - else - load.clear(ios::badbit | load.rdstate()); - - isOK = (load >> i); - if (isOK) - myToCreateNewNodes = (bool) i; - else - load.clear(ios::badbit | load.rdstate()); - - isOK = (load >> i); - if (isOK) - myToUseBoundaryRecoveryVersion = (bool) i; - else - load.clear(ios::badbit | load.rdstate()); - - isOK = (load >> myTextOption); - while (isOK) { - string txt; - if (load >> txt) { - myTextOption += " "; - myTextOption += txt; + if (isOK) + if (separator == "__OPTIONS_BEGIN__") + hasOptions = true; + else if (separator == "__ENFORCED_VERTECES_BEGIN__") + hasEnforcedVerteces = true; + + if (hasOptions) { + std::string txt; + isOK = (load >> myTextOption); + while (isOK) { + if (myTextOption == "__OPTIONS_END__") { + isOK = false; + break; + } + if (load >> txt) { + if (txt == "__OPTIONS_END__") { + isOK = false; + break; + } + myTextOption += " "; + myTextOption += txt; + } + else + isOK = false; + } + } + + if (hasOptions) { + isOK = (load >> separator); + if (isOK) + if (separator == "__ENFORCED_VERTECES_BEGIN__") + hasEnforcedVerteces = true; + } + + if (hasEnforcedVerteces) { + std::string txt; + double x,y,z,size; + while (isOK) { + isOK = (load >> txt); + if (isOK) { + if (txt == "__ENFORCED_VERTECES_END__") { + isOK = false; + break; + } + x = atof(txt.c_str()); + isOK = (load >> y >> z >> size); + } + if (isOK) { + std::vector coord; + coord.push_back(x); + coord.push_back(y); + coord.push_back(z); + mySizeMapVerteces[ coord ] = size; + } + } } - else - isOK = false; - } -// else -// load.clear(ios::badbit | load.rdstate()); return load; } @@ -617,7 +672,7 @@ bool GHS3DPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& /*dflts*/ */ //================================================================================ -string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp, +std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp, const bool hasShapeToMesh) { #ifndef WIN32 @@ -626,13 +681,13 @@ string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp, TCollection_AsciiString cmd( "ghs3d.exe" ); #endif // check if any option is overridden by hyp->myTextOption - bool m = hyp ? ( hyp->myTextOption.find("-m") == string::npos ) : true; - bool M = hyp ? ( hyp->myTextOption.find("-M") == string::npos ) : true; - bool c = hyp ? ( hyp->myTextOption.find("-c") == string::npos ) : true; - bool o = hyp ? ( hyp->myTextOption.find("-o") == string::npos ) : true; - bool p0= hyp ? ( hyp->myTextOption.find("-p0")== string::npos ) : true; - bool C = hyp ? ( hyp->myTextOption.find("-C") == string::npos ) : true; - bool v = hyp ? ( hyp->myTextOption.find("-v") == string::npos ) : true; + bool m = hyp ? ( hyp->myTextOption.find("-m") == std::string::npos ) : true; + bool M = hyp ? ( hyp->myTextOption.find("-M") == std::string::npos ) : true; + bool c = hyp ? ( hyp->myTextOption.find("-c") == std::string::npos ) : true; + bool o = hyp ? ( hyp->myTextOption.find("-o") == std::string::npos ) : true; + bool p0= hyp ? ( hyp->myTextOption.find("-p0")== std::string::npos ) : true; + bool C = hyp ? ( hyp->myTextOption.find("-C") == std::string::npos ) : true; + bool v = hyp ? ( hyp->myTextOption.find("-v") == std::string::npos ) : true; // if use boundary recovery version, few options are allowed bool useBndRecovery = !C; @@ -714,9 +769,9 @@ string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp, */ //================================================================================ -string GHS3DPlugin_Hypothesis::GetFileName(const GHS3DPlugin_Hypothesis* hyp) +std::string GHS3DPlugin_Hypothesis::GetFileName(const GHS3DPlugin_Hypothesis* hyp) { - string aTmpDir = hyp ? hyp->GetWorkingDirectory() : DefaultWorkingDirectory(); + std::string aTmpDir = hyp ? hyp->GetWorkingDirectory() : DefaultWorkingDirectory(); const char lastChar = *aTmpDir.rbegin(); #ifdef WIN32 if(lastChar != '\\') aTmpDir+='\\'; diff --git a/src/GHS3DPlugin_Hypothesis.hxx b/src/GHS3DPlugin_Hypothesis.hxx index f4317ff..cab3b68 100644 --- a/src/GHS3DPlugin_Hypothesis.hxx +++ b/src/GHS3DPlugin_Hypothesis.hxx @@ -27,10 +27,12 @@ #include "GHS3DPlugin_Defs.hxx" #include +#include + #include #include +#include #include -using namespace std; class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis: public SMESH_Hypothesis { @@ -63,8 +65,8 @@ public: /*! * Path to working directory */ - void SetWorkingDirectory(const string& path); - string GetWorkingDirectory() const; + void SetWorkingDirectory(const std::string& path); + std::string GetWorkingDirectory() const; /*! * To keep working files or remove them. Log file remains in case of errors anyway. */ @@ -96,19 +98,12 @@ public: /*! * To set hiden/undocumented/advanced options */ - void SetTextOption(const string& option); - string GetTextOption() const; + void SetTextOption(const std::string& option); + std::string GetTextOption() const; /*! * To set an enforced vertex */ - typedef struct - { - double x; - double y; - double z; - } GHS3DSizeMapVertex; - - typedef std::map TSizeMapVertexValues; + typedef std::map,double> TSizeMapVertexValues; void SetSizeMapVertex(double x, double y, double z, double size); double GetSizeMapVertex(double x, double y, double z) throw (std::invalid_argument); void RemoveSizeMapVertex(double x, double y, double z) throw (std::invalid_argument); @@ -119,7 +114,7 @@ public: static short DefaultMaximumMemory(); static short DefaultInitialMemory(); static short DefaultOptimizationLevel(); - static string DefaultWorkingDirectory(); + static std::string DefaultWorkingDirectory(); static bool DefaultKeepFiles(); static short DefaultVerboseLevel(); static bool DefaultToCreateNewNodes(); @@ -141,10 +136,10 @@ public: static TSizeMapVertexValues GetEnforcedVerteces(const GHS3DPlugin_Hypothesis* hyp); // Persistence - virtual ostream & SaveTo(ostream & save); - virtual istream & LoadFrom(istream & load); - friend GHS3DPLUGIN_EXPORT ostream & operator <<(ostream & save, GHS3DPlugin_Hypothesis & hyp); - friend GHS3DPLUGIN_EXPORT istream & operator >>(istream & load, GHS3DPlugin_Hypothesis & hyp); + virtual std::ostream & SaveTo(std::ostream & save); + virtual std::istream & LoadFrom(std::istream & load); + friend GHS3DPLUGIN_EXPORT std::ostream & operator <<(std::ostream & save, GHS3DPlugin_Hypothesis & hyp); + friend GHS3DPLUGIN_EXPORT std::istream & operator >>(std::istream & load, GHS3DPlugin_Hypothesis & hyp); /*! * \brief Does nothing @@ -163,11 +158,11 @@ private: short myInitialMemory; short myOptimizationLevel; bool myKeepFiles; - string myWorkingDirectory; + std::string myWorkingDirectory; short myVerboseLevel; bool myToCreateNewNodes; bool myToUseBoundaryRecoveryVersion; - string myTextOption; + std::string myTextOption; TSizeMapVertexValues mySizeMapVerteces; }; diff --git a/src/GHS3DPlugin_Hypothesis_i.cxx b/src/GHS3DPlugin_Hypothesis_i.cxx index 4b3f278..e7af824 100644 --- a/src/GHS3DPlugin_Hypothesis_i.cxx +++ b/src/GHS3DPlugin_Hypothesis_i.cxx @@ -336,22 +336,20 @@ CORBA::Double GHS3DPlugin_Hypothesis_i::GetSizeMapVertex(CORBA::Double x, CORBA: GHS3DPlugin::GHS3DSizeMapVertexList* GHS3DPlugin_Hypothesis_i::GetSizeMapVerteces() { - std::cout << "GHS3DPlugin_Hypothesis_i::GetSizeMapVerteces()" << std::endl; ASSERT(myBaseImpl); GHS3DPlugin::GHS3DSizeMapVertexList_var result = new GHS3DPlugin::GHS3DSizeMapVertexList(); const ::GHS3DPlugin_Hypothesis::TSizeMapVertexValues sizeMaps = this->GetImpl()->GetSizeMapVerteces(); int size = sizeMaps.size(); -// std::cout << "size: " << size << std::endl; result->length( size ); ::GHS3DPlugin_Hypothesis::TSizeMapVertexValues::const_iterator it; int i = 0; for (it = sizeMaps.begin() ; it != sizeMaps.end(); it++ ) { GHS3DPlugin::GHS3DSizeMapVertex_var myVertex = new GHS3DPlugin::GHS3DSizeMapVertex(); - myVertex->x = it->first->x; - myVertex->y = it->first->y; - myVertex->z = it->first->z; + myVertex->x = it->first[0]; + myVertex->y = it->first[1]; + myVertex->z = it->first[2]; myVertex->size = it->second; result[i]=myVertex; i++; @@ -391,7 +389,6 @@ void GHS3DPlugin_Hypothesis_i::RemoveSizeMapVertex(CORBA::Double x, CORBA::Doubl void GHS3DPlugin_Hypothesis_i::ClearSizeMapVerteces() { - std::cout << "GHS3DPlugin_Hypothesis_i::ClearSizeMapVerteces()" << std::endl; ASSERT(myBaseImpl); this->GetImpl()->ClearSizeMapVerteces(); } diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx index 43672c4..db11e0c 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx @@ -27,19 +27,17 @@ #include #include -#include CORBA_SERVER_HEADER(GHS3DPlugin_Algorithm) - -#include #include -#include +#include #include +#include #include -#include #include +#include #include -#include #include +#include #include #include #include @@ -54,6 +52,7 @@ #include #include +#include enum { STD_TAB = 0, @@ -150,8 +149,7 @@ void DoubleLineEditDelegate::setModelData(QWidget *editor, QAbstractItemModel *m if (ok) { model->setData(index, value, Qt::EditRole); - std::cout << "Value " << value << " was set at index(" << index.row() << "," << index.column() << ")" << std::endl; - std::cout << "model->data(index).toDouble(): " << model->data(index).toDouble() << std::endl; + MESSAGE("Value " << value << " was set at index(" << index.row() << "," << index.column() << ")"); } } @@ -340,25 +338,25 @@ bool GHS3DPluginGUI_HypothesisCreator::smpVertexExists(double x, double y, doubl for (int i=0 ; i < rowCount ; i++) { double myX = mySmpModel->data(mySmpModel->index(i, SMP_X_COLUMN)).toDouble(); if (myX == x) { - std::cout << "Found x value " << x << " at row " << i << std::endl; + MESSAGE("Found x value " << x << " at row " << i); double myY = mySmpModel->data(mySmpModel->index(i, SMP_Y_COLUMN)).toDouble(); if (myY == y) { - std::cout << "Found y value " << y << " at row " << i << std::endl; + MESSAGE("Found y value " << y << " at row " << i); double myZ = mySmpModel->data(mySmpModel->index(i, SMP_Z_COLUMN)).toDouble(); if (myZ == z) { - std::cout << "Found z value " << z << " at row " << i << std::endl; + MESSAGE("Found z value " << z << " at row " << i); return true; } } } } - std::cout << "Not found x,y,z values: " << x << " " << y << " " << z << std::endl; + MESSAGE("Not found x,y,z values: " << x << " " << y << " " << z); return false; } void GHS3DPluginGUI_HypothesisCreator::onVertexBtnClicked() { - std::cout << "GHS3DPluginGUI_HypothesisCreator::onVertexBtnClicked()" << std::endl; + MESSAGE("GHS3DPluginGUI_HypothesisCreator::onVertexBtnClicked()"); const int row = mySmpModel->rowCount() ; double x = myXCoord->text().toDouble(); double y = myYCoord->text().toDouble(); @@ -383,15 +381,6 @@ void GHS3DPluginGUI_HypothesisCreator::onVertexBtnClicked() mySmpModel->setData(mySmpModel->index(row, SMP_SIZE_COLUMN),size); mySmpModel->setItem( row, SMP_SIZE_COLUMN, new QStandardItem(QString::number(size,'f')) ); -// std::cout << "mySmpModel->data(mySmpModel->index("<data(mySmpModel->index(row,SMP_X_COLUMN)).toDouble() << std::endl; -// std::cout << "mySmpModel->data(mySmpModel->index("<data(mySmpModel->index(row,SMP_Y_COLUMN)).toDouble() << std::endl; -// std::cout << "mySmpModel->data(mySmpModel->index("<data(mySmpModel->index(row,SMP_Z_COLUMN)).toDouble() << std::endl; -// std::cout << "mySmpModel->data(mySmpModel->index("<data(mySmpModel->index(row,SMP_SIZE_COLUMN)).toDouble() << std::endl; - mySizeMapTableView->clearSelection(); mySizeMapTableView->scrollTo( mySmpModel->item( row, SMP_SIZE_COLUMN )->index() ); } @@ -412,7 +401,7 @@ void GHS3DPluginGUI_HypothesisCreator::onRemoveVertexBtnClicked() it.toBack(); while ( it.hasPrevious() ) { row = it.previous(); - cout << "delete row #"<< row <removeRow(row ); } mySizeMapTableView->clearSelection(); @@ -432,20 +421,23 @@ void GHS3DPluginGUI_HypothesisCreator::updateWidgets() myOptimizationLevelCombo->setEnabled( !myBoundaryRecoveryCheck->isChecked() ); } -bool GHS3DPluginGUI_HypothesisCreator::checkParams() const +bool GHS3DPluginGUI_HypothesisCreator::checkParams(QString& msg) const { + MESSAGE("GHS3DPluginGUI_HypothesisCreator::checkParams"); + if ( !QFileInfo( myWorkingDir->text().trimmed() ).isWritable() ) { SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ), tr( "GHS3D_PERMISSION_DENIED" ) ); return false; } + return true; } void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const { - std::cout << "GHS3DPluginGUI_HypothesisCreator::retrieveParams" << std::endl; + MESSAGE("GHS3DPluginGUI_HypothesisCreator::retrieveParams"); GHS3DHypothesisData data; readParamsFromHypo( data ); @@ -467,14 +459,14 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const myBoundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery ); myTextOption ->setText ( data.myTextOption ); - TSizeMapVertexValues::iterator it; + TSizeMapVertexValues::const_iterator it; int row = 0; for(it = data.mySizeMapVerteces.begin() ; it != data.mySizeMapVerteces.end(); it++ ) { - double x = it->first->x; - double y = it->first->y; - double z = it->first->z; - double size = it->second; + double x = it->at(0); + double y = it->at(1); + double z = it->at(2); + double size = it->at(3); // SMP_X_COLUMN mySmpModel->setData(mySmpModel->index(row, SMP_X_COLUMN),x); mySmpModel->setItem( row, SMP_X_COLUMN, new QStandardItem(QString::number(x)) ); @@ -491,7 +483,7 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const mySmpModel->setData(mySmpModel->index(row, SMP_SIZE_COLUMN),size); mySmpModel->setItem( row, SMP_SIZE_COLUMN, new QStandardItem(QString::number(size)) ); - std::cout << "Row " << row << ": (" << x << ","<< y << ","<< z << ") ="<< size << std::endl; + MESSAGE("Row " << row << ": (" << x << ","<< y << ","<< z << ") ="<< size); row++; } @@ -501,50 +493,67 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const QString GHS3DPluginGUI_HypothesisCreator::storeParams() const { - std::cout << "GHS3DPluginGUI_HypothesisCreator::storeParams" << std::endl; - GHS3DHypothesisData data; - readParamsFromWidgets( data ); - storeParamsToHypo( data ); - - QString valStr = ""; - - if ( !data.myBoundaryRecovery ) - valStr = "-c " + QString::number( !data.myToMeshHoles ); - - if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 4 && !data.myBoundaryRecovery) { - char* level[] = { "none" , "light" , "standard" , "strong" }; - valStr += " -o "; - valStr += level[ data.myOptimizationLevel ]; - } - if ( data.myMaximumMemory > 0 ) { - valStr += " -m "; - valStr += QString::number( data.myMaximumMemory ); - } - if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) { - valStr += " -M "; - valStr += QString::number( data.myInitialMemory ); - } - valStr += " -v "; - valStr += QString::number( data.myVerboseLevel ); - - if ( !data.myToCreateNewNodes ) - valStr += " -p0"; - - if ( data.myBoundaryRecovery ) - valStr += " -C"; - - valStr += " "; - valStr += data.myTextOption; - - // TODO - // Add size map parameters storage - + MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParams"); + GHS3DHypothesisData data; + readParamsFromWidgets( data ); + storeParamsToHypo( data ); + + QString valStr = ""; + + if ( !data.myBoundaryRecovery ) + valStr = "-c " + QString::number( !data.myToMeshHoles ); + + if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 4 && !data.myBoundaryRecovery) { + char* level[] = { "none" , "light" , "standard" , "strong" }; + valStr += " -o "; + valStr += level[ data.myOptimizationLevel ]; + } + if ( data.myMaximumMemory > 0 ) { + valStr += " -m "; + valStr += QString::number( data.myMaximumMemory ); + } + if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) { + valStr += " -M "; + valStr += QString::number( data.myInitialMemory ); + } + valStr += " -v "; + valStr += QString::number( data.myVerboseLevel ); + + if ( !data.myToCreateNewNodes ) + valStr += " -p0"; + + if ( data.myBoundaryRecovery ) + valStr += " -C"; + + valStr += " "; + valStr += data.myTextOption; + + valStr += " #BEGIN ENFORCED VERTECES#"; + // Add size map parameters storage + for (int i=0 ; irowCount() ; i++) { + valStr += " ("; + double x = mySmpModel->data(mySmpModel->index(i,SMP_X_COLUMN)).toDouble(); + double y = mySmpModel->data(mySmpModel->index(i,SMP_Y_COLUMN)).toDouble(); + double z = mySmpModel->data(mySmpModel->index(i,SMP_Z_COLUMN)).toDouble(); + double size = mySmpModel->data(mySmpModel->index(i,SMP_SIZE_COLUMN)).toDouble(); + valStr += QString::number( x ); + valStr += ","; + valStr += QString::number( y ); + valStr += ","; + valStr += QString::number( z ); + valStr += ")="; + valStr += QString::number( size ); + if (i!=mySmpModel->rowCount()-1) + valStr += ";"; + } + valStr += " #END ENFORCED VERTECES#"; + MESSAGE(valStr.toStdString()); return valStr; } bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& h_data ) const { - std::cout << "GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo" << std::endl; + MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo"); GHS3DPlugin::GHS3DPlugin_Hypothesis_var h = GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( initParamsHypothesis() ); @@ -564,23 +573,23 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& h_data.myTextOption = h->GetTextOption(); GHS3DPlugin::GHS3DSizeMapVertexList_var verteces = h->GetSizeMapVerteces(); - std::cout << "verteces->length(): " << verteces->length() << std::endl; + MESSAGE("verteces->length(): " << verteces->length()); h_data.mySizeMapVerteces.clear(); for (int i=0 ; ilength() ; i++) { - GHS3DSizeMapVertex* myVertex = new GHS3DSizeMapVertex; - myVertex->x = verteces[i].x; - myVertex->y = verteces[i].y; - myVertex->z = verteces[i].z; - double size = verteces[i].size; - std::cout << "Add enforced vertex ("<< myVertex->x << ","<< myVertex->y << ","<< myVertex->z << ") ="<< size << std::endl; - h_data.mySizeMapVerteces[myVertex] = size; + GHS3DSizeMapVertex myVertex; + myVertex.push_back(verteces[i].x); + myVertex.push_back(verteces[i].y); + myVertex.push_back(verteces[i].z); + myVertex.push_back(verteces[i].size); + MESSAGE("Add enforced vertex ("<< myVertex[0] << ","<< myVertex[1] << ","<< myVertex[2] << ") ="<< myVertex[3]); + h_data.mySizeMapVerteces.push_back(myVertex); } return true; } bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisData& h_data ) const { - std::cout << "GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo" << std::endl; + MESSAGE("GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo"); GHS3DPlugin::GHS3DPlugin_Hypothesis_var h = GHS3DPlugin::GHS3DPlugin_Hypothesis::_narrow( hypothesis() ); @@ -617,8 +626,8 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD GHS3DPlugin::GHS3DSizeMapVertexList_var vertexHyp = h->GetSizeMapVerteces(); int nbVertexHyp = vertexHyp->length(); - std::cout << "Store params for size maps: " << nbVertex << " enforced verteces" << std::endl; - std::cout << "h->GetSizeMapVerteces()->length(): " << nbVertexHyp << std::endl; + MESSAGE("Store params for size maps: " << nbVertex << " enforced verteces"); + MESSAGE("h->GetSizeMapVerteces()->length(): " << nbVertexHyp); // Some verteces were removed if (nbVertex < nbVertexHyp) { @@ -626,9 +635,7 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD h->ClearSizeMapVerteces(); else { // iterate over verteces of hypo -// GHS3DPlugin_Hypothesis::TSizeMapVertexValues::const_iterator vertexHypIt; for(int i = 0 ; i GetSizeMapVerteces()->length() > 0) -// h->ClearSizeMapVerteces(); -// else -// h->ClearSizeMapVerteces(); - TSizeMapVertexValues::const_iterator it; for(it = h_data.mySizeMapVerteces.begin() ; it != h_data.mySizeMapVerteces.end(); it++ ) { - double x = it->first->x; - double y = it->first->y; - double z = it->first->z; - double size = it->second; - std::cout << "(" << x << ", " + double x = it->at(0); + double y = it->at(1); + double z = it->at(2); + double size = it->at(3); + MESSAGE("(" << x << ", " << y << ", " << z << ") = " - << size << std::endl; + << size ); double mySize; try { mySize = h->GetSizeMapVertex(x,y,z); - std::cout << "Old size: " << mySize << std::endl; + MESSAGE("Old size: " << mySize); if (mySize != size) { - std::cout << "Setting new size: " << size << std::endl; + MESSAGE("Setting new size: " << size); h->SetSizeMapVertex(x,y,z,size); } } catch (...) { - std::cout << "Setting new size: " << size << std::endl; + MESSAGE("Setting new size: " << size); h->SetSizeMapVertex(x,y,z,size); } } @@ -680,7 +681,7 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisData& h_data ) const { - std::cout << "GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets" << std::endl; + MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets"); h_data.myName = myName ? myName->text() : ""; h_data.myToMeshHoles = myToMeshHolesCheck->isChecked(); h_data.myMaximumMemory = myMaximumMemoryCheck->isChecked() ? myMaximumMemorySpin->value() : -1; @@ -693,17 +694,18 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisDat h_data.myBoundaryRecovery = myBoundaryRecoveryCheck->isChecked(); h_data.myTextOption = myTextOption->text(); h_data.mySizeMapVerteces.clear(); + for (int i=0 ; irowCount() ; i++) { - GHS3DSizeMapVertex* myVertex = new GHS3DSizeMapVertex; - myVertex->x = mySmpModel->data(mySmpModel->index(i,SMP_X_COLUMN)).toDouble(); - myVertex->y = mySmpModel->data(mySmpModel->index(i,SMP_Y_COLUMN)).toDouble(); - myVertex->z = mySmpModel->data(mySmpModel->index(i,SMP_Z_COLUMN)).toDouble(); - double size = mySmpModel->data(mySmpModel->index(i,SMP_SIZE_COLUMN)).toDouble(); - std::cout << "Add new enforced vertex (" << myVertex->x << ", " - << myVertex->y << ", " - << myVertex->z << ") = " - << size << std::endl; - h_data.mySizeMapVerteces[myVertex] = size; + GHS3DSizeMapVertex myVertex; + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,SMP_X_COLUMN)).toDouble()); + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,SMP_Y_COLUMN)).toDouble()); + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,SMP_Z_COLUMN)).toDouble()); + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,SMP_SIZE_COLUMN)).toDouble()); + MESSAGE("Add new enforced vertex (" << myVertex[0] << ", " + << myVertex[1] << ", " + << myVertex[2] << ") = " + << myVertex[3]); + h_data.mySizeMapVerteces.push_back(myVertex); } return true; diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h index 6f6975b..e959cd7 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h @@ -26,9 +26,12 @@ #include "GHS3DPlugin_Defs.hxx" #include +// #include + #include #include #include +#include CORBA_SERVER_HEADER(GHS3DPlugin_Algorithm) class QWidget; class QComboBox; @@ -44,31 +47,17 @@ class QItemDelegate; class QStandardItem; class QDoubleValidator; -typedef struct -{ - double x; - double y; - double z; -} GHS3DSizeMapVertex; -typedef std::map TSizeMapVertexValues; +typedef std::vector GHS3DSizeMapVertex; +typedef std::vector TSizeMapVertexValues; typedef struct { - bool myToMeshHoles; - int myMaximumMemory; - int myInitialMemory; - int myOptimizationLevel; - bool myKeepFiles; - QString myWorkingDir; - QString myName; + bool myToMeshHoles,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery; + int myMaximumMemory,myInitialMemory,myOptimizationLevel; + QString myName,myWorkingDir,myTextOption; short myVerboseLevel; - bool myToCreateNewNodes; - bool myBoundaryRecovery; - QString myTextOption; TSizeMapVertexValues mySizeMapVerteces; -// QList mySizeMapVerteces; - } GHS3DHypothesisData; /*! @@ -82,7 +71,7 @@ public: GHS3DPluginGUI_HypothesisCreator( const QString& ); virtual ~GHS3DPluginGUI_HypothesisCreator(); - virtual bool checkParams() const; + virtual bool checkParams(QString& msg) const; virtual QString helpPage() const; protected: