#include "MG_ADAPT.hxx"
-#include "SMESH_File.hxx"
-#include "SMESH_Comment.hxx"
+#include <DriverGMF_Read.hxx>
+#include <SMESH_Comment.hxx>
+#include <SMESH_File.hxx>
+#include <SMESH_MGLicenseKeyGen.hxx>
+#include <SMESH_TypeDefs.hxx>
#include <MEDFileData.hxx>
#include <MEDFileField.hxx>
#include <Utils_SALOME_Exception.hxx>
#include <Basics_Utils.hxx>
+#include "SMESH_TypeDefs.hxx"
#ifndef WIN32
#include <unistd.h> // getpid()
}
void MgAdapt::setMedFileIn(std::string fileName)
{
- if ( isFileExist(fileName) )
+ if ( isFileExist( fileName ))
{
medFileIn = fileName;
cmd += " --";
else
cmd += " ";
-// std::cout << "--- option: '" << option << ", value: '" << value <<"'"<< std::endl;
+ // std::cout << "--- option: '" << option << ", value: '" << value <<"'"<< std::endl;
cmd += option + " " + value;
}
}
{
cmd+= " --verbose "+ ToComment(verbosityLevel);
}
- //~}
-//~cmd+= " >"
+ // get license key
+ {
+ smIdType nbVertex, nbEdge, nbFace, nbVol;
+ DriverGMF_Read gmfReader;
+ gmfReader.SetFile( meshIn );
+ gmfReader.GetMeshInfo( nbVertex, nbEdge, nbFace, nbVol );
+
+ std::string errorTxt;
+ std::string key = SMESHUtils_MGLicenseKeyGen::GetKey( meshIn,
+ FromSmIdType<int>( nbVertex ),
+ FromSmIdType<int>( nbEdge ),
+ FromSmIdType<int>( nbFace ),
+ FromSmIdType<int>( nbVol ),
+ errorTxt );
+ if ( key.empty() )
+ return ToComment( "Problem with library SalomeMeshGemsKeyGenerator: " + errorTxt );
+
+ cmd += " --key " + key;
+ }
+
#ifdef WIN32
- cmd += " < NUL";
+ cmd += " < NUL";
#endif
-// std::cout << "--- cmd :"<< std::endl;
-// std::cout << cmd << std::endl;
+ // std::cout << "--- cmd :"<< std::endl;
+ // std::cout << cmd << std::endl;
return cmd;
}
{
aTmpDir = Tmp_dir;
}
- else {
+
+ if ( ! isFileExist( aTmpDir ))
+ {
#ifdef WIN32
aTmpDir = "C:\\";
#else
checkTimeStepRank(medFileIn) ;
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeFieldMultiTS> fts( mfd->getFields()->getFieldWithName(fieldName) );
MEDCoupling::MCAuto<MEDCoupling::MEDFileAnyTypeField1TS> f = fts->getTimeStep(timeStep, rank);
- MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> tmFts = MEDCoupling::MEDFileFieldMultiTS::New();
- tmFts->pushBackTimeStep(f);
+ MEDCoupling::MCAuto<MEDCoupling::MEDFileFieldMultiTS> tmFts = MEDCoupling::DynamicCast<MEDCoupling::MEDFileAnyTypeFieldMultiTS,MEDCoupling::MEDFileFieldMultiTS>(fts);
+
+ // if not able to cast to double field, try float field
+ if (!tmFts)
+ {
+ MEDCoupling::MCAuto<MEDCoupling::MEDFileFloatFieldMultiTS> tmFtsFloat = MEDCoupling::DynamicCast<MEDCoupling::MEDFileAnyTypeFieldMultiTS,MEDCoupling::MEDFileFloatFieldMultiTS>(fts);
+ if (!tmFtsFloat)
+ THROW_SALOME_EXCEPTION("\nUnexpected field type.\n");
+ // convert float field to double
+ tmFts = tmFtsFloat->convertToDouble();
+ }
fields->pushField(tmFts);