echo "mg-hybrid.bash initial parameters are:" $*
#$0 is ignored
-echo "mg-hybrid.bash assume licence file set:"
-env | grep DLIM
-
findOutFile $*
echo "result output File is:" $resFindOutFile
-$MESHGEMS_ROOT_DIR/bin/run_mg-hybrid.sh $*
+if test -f "$MESHGEMS_ROOT_DIR/bin/run_mg-hybrid.sh"; then
+
+ echo "mg-hybrid.bash assume licence file set:"
+ env | grep DLIM
+
+
+ $MESHGEMS_ROOT_DIR/bin/run_mg-hybrid.sh $*
+else
+ $MESHGEMS_ROOT_DIR/bin/Linux_64/mg-hybrid.exe $*
+fi
#$MESHGEMS_ROOT_DIR/bin/Linux_64/mg-hybrid.exe $*
${SMESH_SMDS}
${SMESH_StdMeshers}
${SMESH_MeshDriverGMF}
+ ${SMESH_SMESHUtils}
${KERNEL_SalomeGenericObj}
${KERNEL_SALOMELocalTrace}
${KERNEL_SALOMEBasics}
bool HYBRIDPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::smIdType_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
{
TIDSortedElemSet theElemSet;
- if ( theIDs->length() == 0 ){MESSAGE("The source group is empty");}
- for ( SMESH::smIdType i = 0; i < theIDs->length(); i++) {
- SMESH::smIdType ind = theIDs[i];
- if (elementType == SMESH::NODE)
- {
- const SMDS_MeshNode * node = theMeshDS->FindNode(ind);
- if (node)
- theElemSet.insert( node );
- }
- else
- {
- const SMDS_MeshElement * elem = theMeshDS->FindElement(ind);
- if (elem)
- theElemSet.insert( elem );
- }
+ if ( theIDs->length() == 0 ){MESSAGE("The source group is empty");}
+ for ( CORBA::ULong i = 0; i < theIDs->length(); i++)
+ {
+ SMESH::smIdType ind = theIDs[i];
+ if (elementType == SMESH::NODE)
+ {
+ const SMDS_MeshNode * node = theMeshDS->FindNode(ind);
+ if (node)
+ theElemSet.insert( node );
}
+ else
+ {
+ const SMDS_MeshElement * elem = theMeshDS->FindElement(ind);
+ if (elem)
+ theElemSet.insert( elem );
+ }
+ }
-// SMDS_ElemIteratorPtr it = theGroup->GetGroupDS()->GetElements();
-// while ( it->more() )
-// theElemSet.insert( it->next() );
+ // SMDS_ElemIteratorPtr it = theGroup->GetGroupDS()->GetElements();
+ // while ( it->more() )
+ // theElemSet.insert( it->next() );
bool added = SetEnforcedElements( theElemSet, elementType, groupName);
if (added) {
newEnfMesh->entry = entry;
newEnfMesh->elementType = elementType;
newEnfMesh->groupName = groupName;
-
+
THYBRIDEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
if (it == _enfMeshList.end()) {
_entryEnfMeshMap[entry].insert(newEnfMesh);
#include <SMESH_Comment.hxx>
#include <SMESH_File.hxx>
+#include <SMESH_MGLicenseKeyGen.hxx>
#include <Utils_SALOME_Exception.hxx>
-#include <vector>
-#include <iterator>
#include <cstring>
+#include <iostream>
+#include <iterator>
+#include <vector>
#ifdef USE_MG_LIBS
bool MG_HYBRID_API::LibData::Compute()
{
+ // MG license
+ std::string errorTxt;
+ if ( !SMESHUtils_MGLicenseKeyGen::SignMesh( _surf_mesh, errorTxt ))
+ {
+ AddError( SMESH_Comment( "Problem with library SalomeMeshGemsKeyGenerator: ") << errorTxt );
+ return false;
+ }
+
// Set surface mesh
status_t ret = hybrid_set_surface_mesh( _session, _surf_mesh );
if ( ret != STATUS_OK ) MG_Error( "unable to set surface mesh");
//================================================================================
MG_HYBRID_API::MG_HYBRID_API(volatile bool& cancelled_flag, double& progress)
+ :_nbNodes(0), _nbEdges(0), _nbFaces(0), _nbVolumes(0)
{
_useLib = false;
_libData = new LibData( cancelled_flag, progress );
#endif
}
+ // add MG license key
+ {
+ std::string errorTxt, meshIn;
+ std::string key = SMESHUtils_MGLicenseKeyGen::GetKey( meshIn,
+ _nbNodes, _nbEdges, _nbFaces, _nbVolumes,
+ errorTxt );
+ if ( key.empty() )
+ {
+ errStr = "Problem with library SalomeMeshGemsKeyGenerator: " + errorTxt;
+ return false;
+ }
+
+ const_cast< std::string& >( cmdLine ) += " --key " + key;
+ }
+
int err = system( cmdLine.c_str() ); // run
if ( err )
void MG_HYBRID_API::GmfSetKwd(int iMesh, GmfKwdCod what, int nb )
{
+ if ( iMesh == 1 )
+ {
+ switch ( what ) {
+ case GmfVertices: _nbNodes = nb; break;
+ case GmfEdges: _nbEdges = nb; break;
+ case GmfTriangles: _nbFaces += nb; break;
+ case GmfQuadrilaterals: _nbFaces += nb; break;
+ default:;
+ }
+ }
if ( _useLib ) {
#ifdef USE_MG_LIBS
switch ( what ) {
LibData* _libData;
std::set<int> _openFiles;
std::string _logFile;
+
+ // count mesh entities for MG license key generation
+ int _nbNodes;
+ int _nbEdges;
+ int _nbFaces;
+ int _nbVolumes;
};
#endif