23586: [EDF] HYDRO: Copy mesh to new geometry

This commit is contained in:
eap 2018-09-17 22:10:15 +03:00
parent 26da39d104
commit 63eaf4f396
7 changed files with 91 additions and 4 deletions

View File

@ -182,6 +182,14 @@ class NETGEN_Algorithm(Mesh_Algorithm):
self.Parameters().SetMeshSizeFile(file) self.Parameters().SetMeshSizeFile(file)
pass pass
## Set size of elements on a shape
# @param shape - geometry
# @param size - element size
def SetLocalSizeOnShape(self, shape, size ):
self.Parameters().SetLocalSizeOnShape(shape, size)
pass
pass # end of NETGEN_Algorithm class pass # end of NETGEN_Algorithm class

View File

@ -54,7 +54,6 @@ NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId,
_chordalError (GetDefaultChordalError() ), _chordalError (GetDefaultChordalError() ),
_secondOrder (GetDefaultSecondOrder()), _secondOrder (GetDefaultSecondOrder()),
_optimize (GetDefaultOptimize()), _optimize (GetDefaultOptimize()),
_localSize (GetDefaultLocalSize()),
_quadAllowed (GetDefaultQuadAllowed()), _quadAllowed (GetDefaultQuadAllowed()),
_surfaceCurvature (GetDefaultSurfaceCurvature()), _surfaceCurvature (GetDefaultSurfaceCurvature()),
_fuseEdges (GetDefaultFuseEdges()) _fuseEdges (GetDefaultFuseEdges())

View File

@ -89,7 +89,6 @@ public:
double GetChordalError() const { return _chordalError; } double GetChordalError() const { return _chordalError; }
typedef std::map<std::string, double> TLocalSize; typedef std::map<std::string, double> TLocalSize;
static TLocalSize GetDefaultLocalSize() { return TLocalSize(); }
void SetLocalSizeOnEntry(const std::string& entry, double localSize); void SetLocalSizeOnEntry(const std::string& entry, double localSize);
double GetLocalSizeOnEntry(const std::string& entry); double GetLocalSizeOnEntry(const std::string& entry);
const TLocalSize& GetLocalSizesAndEntries() const { return _localSize; } const TLocalSize& GetLocalSizesAndEntries() const { return _localSize; }

View File

@ -534,3 +534,51 @@ std::string NETGENPlugin_Hypothesis_i::getMethodOfParameter(const int paramIndex
} }
return ""; return "";
} }
//================================================================================
/*!
* \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
*/
//================================================================================
bool
NETGENPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & subIDArray ) const
{
typedef ::NETGENPlugin_Hypothesis THyp;
const THyp* h = static_cast< ::NETGENPlugin_Hypothesis* >( myBaseImpl );
const THyp::TLocalSize& ls = h->GetLocalSizesAndEntries();
THyp::TLocalSize::const_iterator entry2size = ls.cbegin();
for ( ; entry2size != ls.cend(); ++entry2size )
entryArray.push_back( entry2size->first );
return true;
}
//================================================================================
/*!
* \brief Set new geometry instead of that returned by getObjectsDependOn()
*/
//================================================================================
bool
NETGENPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & subIDArray )
{
typedef ::NETGENPlugin_Hypothesis THyp;
const THyp* h = static_cast< ::NETGENPlugin_Hypothesis* >( myBaseImpl );
THyp::TLocalSize& lsNew = const_cast< THyp::TLocalSize& >( h->GetLocalSizesAndEntries() );
THyp::TLocalSize ls;
lsNew.swap( ls );
THyp::TLocalSize::const_iterator entry2size = ls.cbegin();
for ( int i = 0; entry2size != ls.cend(); ++entry2size, ++i )
if ( !entryArray[ i ].empty() )
lsNew[ entryArray[ i ]] = entry2size->second;
return true;
}

View File

@ -108,6 +108,17 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
// Methods for copying mesh definition to other geometry
// Return geometry this hypothesis depends on. Return false if there is no geometry parameter
virtual bool getObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & subIDArray ) const;
// Set new geometry instead of that returned by getObjectsDependOn()
virtual bool setObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & subIDArray );
protected: protected:
// to remember whether a parameter is already set (issue 0021364) // to remember whether a parameter is already set (issue 0021364)
@ -127,7 +138,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
METH_SetFuseEdges = METH_SetSurfaceCurvature * 2, METH_SetFuseEdges = METH_SetSurfaceCurvature * 2,
METH_SetChordalErrorEnabled = METH_SetFuseEdges * 2, METH_SetChordalErrorEnabled = METH_SetFuseEdges * 2,
METH_SetChordalError = METH_SetChordalErrorEnabled * 2, METH_SetChordalError = METH_SetChordalErrorEnabled * 2,
METH_LAST = METH_SetFuseEdges METH_LAST = METH_SetChordalError
}; };
int mySetMethodFlags; int mySetMethodFlags;

View File

@ -80,6 +80,17 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_SimpleHypothesis_2D_i:
// into myMethod2VarParams. It should return a method name for an index of // into myMethod2VarParams. It should return a method name for an index of
// variable parameters. Index is countered from zero // variable parameters. Index is countered from zero
virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const; virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
// Methods for copying mesh definition to other geometry
// Return geometry this hypothesis depends on. Return false if there is no geometry parameter
virtual bool getObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & subIDArray ) const { return 0; }
// Set new geometry instead of that returned by getObjectsDependOn()
virtual bool setObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & subIDArray ) { return true; }
}; };
#endif #endif

View File

@ -58,6 +58,17 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_SimpleHypothesis_3D_i:
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
// Methods for copying mesh definition to other geometry
// Return geometry this hypothesis depends on. Return false if there is no geometry parameter
virtual bool getObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & subIDArray ) const { return 0; }
// Set new geometry instead of that returned by getObjectsDependOn()
virtual bool setObjectsDependOn( std::vector< std::string > & entryArray,
std::vector< int > & subIDArray ) { return true; }
}; };
#endif #endif