* \brief see MULTIPR_i.hxx
*
* \author Olivier LE ROUX - CS, Virtual Reality Dpt
- *
+ *
* \date 01/2007
*/
-
+
//*****************************************************************************
// Includes section
//*****************************************************************************
-
+
using namespace std;
#include "MULTIPR_i.hxx"
MULTIPR_Gen_i::MULTIPR_Gen_i
(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
- PortableServer::ObjectId* contId,
- const char* instanceName,
+ PortableServer::ObjectId* contId,
+ const char* instanceName,
const char* interfaceName) :
Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
{
void MULTIPR_Gen_i::partitionneDomaine(
- const char* medFilename,
+ const char* medFilename,
const char* meshName)
throw (SALOME::SALOME_Exception)
{
void MULTIPR_Gen_i::partitionneGrain(
- const char* medFilename,
- const char* partName,
- CORBA::Long nbParts,
+ const char* medFilename,
+ const char* partName,
+ CORBA::Long nbParts,
CORBA::Long partitionner)
throw (SALOME::SALOME_Exception)
{
void MULTIPR_Gen_i::decimePartition(
- const char* medFilename,
- const char* partName,
+ const char* medFilename,
+ const char* partName,
const char* fieldName,
CORBA::Long fieldIt,
const char* filterName,
cout << "Box : " << boxing << endl;
cout << endl;
*/
-
+
try
{
multipr::decimePartition(
- medFilename,
- partName,
+ medFilename,
+ partName,
fieldName,
fieldIt,
filterName,
throw (SALOME::SALOME_Exception)
{
if (mObj == NULL) THROW_SALOME_CORBA_EXCEPTION("No associated MED file", SALOME::INTERNAL_ERROR);
-
+
return mObj->isValidSequentialMEDFile();
}
throw (SALOME::SALOME_Exception)
{
if (mObj == NULL) THROW_SALOME_CORBA_EXCEPTION("No associated MED file", SALOME::INTERNAL_ERROR);
-
+
return mObj->isValidDistributedMEDFile();
}
throw (SALOME::SALOME_Exception)
{
if (mObj == NULL) THROW_SALOME_CORBA_EXCEPTION("No associated MED file", SALOME::INTERNAL_ERROR);
-
+
return CORBA::string_dup(mObj->getMEDFilename().c_str());
}
throw (SALOME::SALOME_Exception)
{
if (mObj == NULL) THROW_SALOME_CORBA_EXCEPTION("No associated MED file", SALOME::INTERNAL_ERROR);
-
+
return CORBA::string_dup(mObj->getSequentialMEDFilename().c_str());
}
}
-MULTIPR_ORB::string_array* MULTIPR_Obj_i::getMeshes()
+MULTIPR_ORB::string_array* MULTIPR_Obj_i::getMeshes()
throw (SALOME::SALOME_Exception)
{
if (mObj == NULL) THROW_SALOME_CORBA_EXCEPTION("No associated MED file", SALOME::INTERNAL_ERROR);
-
+
MULTIPR_ORB::string_array_var mySeq = new MULTIPR_ORB::string_array();
-
+
try
{
std::vector<std::string> listMeshes = mObj->getMeshes();
mySeq->length(listMeshes.size());
-
+
for (size_t i = 0 ; i < listMeshes.size() ; i++)
{
mySeq[i] = CORBA::string_dup(listMeshes[i].c_str());
e.dump(cout);
THROW_SALOME_CORBA_EXCEPTION("Unable to get meshes", SALOME::INTERNAL_ERROR);
}
-
+
return mySeq._retn();
}
-MULTIPR_ORB::string_array* MULTIPR_Obj_i::getFields()
+MULTIPR_ORB::string_array* MULTIPR_Obj_i::getFields()
throw (SALOME::SALOME_Exception)
{
if (mObj == NULL) THROW_SALOME_CORBA_EXCEPTION("No associated MED file", SALOME::INTERNAL_ERROR);
-
+
MULTIPR_ORB::string_array_var mySeq = new MULTIPR_ORB::string_array();
-
+
try
{
std::vector<std::string> listFields = mObj->getFields();
mySeq->length(listFields.size());
-
+
for (size_t i = 0 ; i < listFields.size() ; i++)
{
mySeq[i] = CORBA::string_dup(listFields[i].c_str());
e.dump(cout);
THROW_SALOME_CORBA_EXCEPTION("Unable to get fields", SALOME::INTERNAL_ERROR);
}
-
+
return mySeq._retn();
}
throw (SALOME::SALOME_Exception)
{
if (mObj == NULL) THROW_SALOME_CORBA_EXCEPTION("No associated MED file", SALOME::INTERNAL_ERROR);
-
+
try
{
return mObj->getTimeStamps(fieldName);
throw (SALOME::SALOME_Exception)
{
if (mObj == NULL) THROW_SALOME_CORBA_EXCEPTION("No associated MED file", SALOME::INTERNAL_ERROR);
-
+
MULTIPR_ORB::string_array_var mySeq = new MULTIPR_ORB::string_array();
-
+
try
{
std::vector<std::string> listParts = mObj->getParts();
mySeq->length(listParts.size());
-
+
for (size_t i = 0 ; i < listParts.size() ; i++)
{
mySeq[i] = CORBA::string_dup(listParts[i].c_str());
e.dump(cout);
THROW_SALOME_CORBA_EXCEPTION("Unable to get parts", SALOME::INTERNAL_ERROR);
}
-
+
return mySeq._retn();
}
throw (SALOME::SALOME_Exception)
{
if (mObj == NULL) THROW_SALOME_CORBA_EXCEPTION("No associated MED file", SALOME::INTERNAL_ERROR);
-
+
return CORBA::string_dup(mObj->getPartInfo(pPartName).c_str());
}
MULTIPR_ORB::string_array* MULTIPR_Obj_i::partitionneGrain(
- const char* pPartName,
- CORBA::Long pNbParts,
+ const char* pPartName,
+ CORBA::Long pNbParts,
CORBA::Long pPartitionner)
throw (SALOME::SALOME_Exception)
{
}
+MULTIPR_ORB::string_array* MULTIPR_Obj_i::decimatePart(
+ const char* pPartName,
+ const char* pFieldName,
+ CORBA::Long pFieldIt,
+ const char* pFilterName,
+ CORBA::Double pTmed,
+ CORBA::Double pTlow,
+ CORBA::Double pRadius)
+ throw (SALOME::SALOME_Exception)
+{
+ if (mObj == NULL) THROW_SALOME_CORBA_EXCEPTION("No associated MED file", SALOME::INTERNAL_ERROR);
+
+ MULTIPR_ORB::string_array_var mySeq = new MULTIPR_ORB::string_array();
+
+ try
+ {
+ std::list<std::string> emptyParts;
+ mObj->decimePartition(pPartName,
+ pFieldName,
+ pFieldIt,
+ pFilterName,
+ pTmed,
+ pTlow,
+ pRadius,
+ mBoxing,
+ emptyParts);
+
+ mySeq->length(emptyParts.size());
+ std::list<std::string>::const_iterator it = emptyParts.begin(), end = emptyParts.end();
+ for (size_t i = 0; it != end; it++, i++)
+ {
+ mySeq[i] = CORBA::string_dup((*it).c_str());
+ }
+
+ // Dump Python
+ MULTIPR::TPythonDump(_engine) << "empty_parts = " << this << ".decimatePart(\""
+ << pPartName << "\", \"" << pFieldName << "\", "
+ << pFieldIt << ", \"" << pFilterName << "\", "
+ << pTmed << ", " << pTlow << ", " << pRadius << ")";
+ }
+ catch (multipr::RuntimeException& e)
+ {
+ e.dump(cout);
+ THROW_SALOME_CORBA_EXCEPTION("Unable to decimate", SALOME::INTERNAL_ERROR);
+ }
+
+ return mySeq._retn();
+}
+
+
char* MULTIPR_Obj_i::evalDecimationParams(
- const char* pPartName,
- const char* pFieldName,
- CORBA::Long pFieldIt,
+ const char* pPartName,
+ const char* pFieldName,
+ CORBA::Long pFieldIt,
const char* pFilterName,
const char* pFilterParams)
throw (SALOME::SALOME_Exception)
int lId;
char lPartName[256];
char lPath[256];
- char lMEDFileName[256];
+ char lMEDFileName[256];
for (unsigned int i = 0; i < nbParts; i++) // each part MED files
{
//bool hasNotPublishedObjects = aScript.Location( NotPublishedObjectName(), 1, aLen);
//isValidScript = isValidScript && !hasNotPublishedObjects;
- return aStreamFile._retn();
+ return aStreamFile._retn();
}
/*! DumpPython_impl
*/
-std::string MULTIPR_Gen_i::DumpPython_impl (int theStudyID,
- bool isPublished,
+std::string MULTIPR_Gen_i::DumpPython_impl (int theStudyID,
+ bool isPublished,
bool& aValidScript,
std::string theSavedTrace)
{
if ( CORBA::is_nil( aComp ) )
return father._retn();
- SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
+ SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributePixMap_var aPixmap;
bool isPersistence = false,
bool isMultifile = false)
throw (SALOME::SALOME_Exception);
-
+
/**
* Destructor.
*/
virtual ~MULTIPR_Obj_i();
-
+
//---------------------------------------------------------------------
// Basic accessors/mutators
//--------------------------------------------------------------------
-
+
/**
* Returns true iff this obj represents a valid sequential MED file.
* \return true iff this obj represents a valid sequential MED file.
*/
CORBA::Boolean isValidSequentialMEDFile()
throw (SALOME::SALOME_Exception);
-
+
/**
* Returns true iff this obj represents a valid distributed MED file.
* \return true iff this obj represents a valid distributed MED file.
*/
CORBA::Boolean isValidDistributedMEDFile()
throw (SALOME::SALOME_Exception);
-
+
/**
* Returns the name of the associated MED file.
* \return the name of the associated MED file.
*/
char* getFilename()
throw (SALOME::SALOME_Exception);
-
+
/**
* Returns the name of the associated sequential MED file (for a distributed MED file).
* \return the name of the associated sequential MED file (for a distributed MED file).
*/
MULTIPR_ORB::string_array* getFields()
throw (SALOME::SALOME_Exception);
-
+
/**
* Returns the number of timestamps for a given field.
* Assumes this object encapsulates a sequential MED file.
*/
CORBA::Long getTimeStamps(const char* pFieldName)
throw (SALOME::SALOME_Exception);
-
+
/**
* Returns the name of all partitions.
* Assumes this object encapsulates a distributed MED file.
*/
char* getPartInfo(const char* pPartName)
throw (SALOME::SALOME_Exception);
-
+
//---------------------------------------------------------------------
// Algorithms
//---------------------------------------------------------------------
-
+
/**
* Creates a distributed MED file (v2.3) by extracting all the groups from the current mesh of the current MED sequential MED file.
* Assumes:
*/
MULTIPR_ORB::string_array* partitionneDomaine()
throw (SALOME::SALOME_Exception);
-
+
/**
* Creates a distributed MED file (V2.3) by splitting a group of a MED file previously created by partitionneDomaine.
* Assumes:
CORBA::Long pNbParts,
CORBA::Long pPartitionner)
throw (SALOME::SALOME_Exception);
-
+
/**
* Creates 3 resolutions of the given part of a distributed MED file (V2.3).
* Assumes:
CORBA::Double pTlow,
CORBA::Double pRadius)
throw (SALOME::SALOME_Exception);
-
+
+ /**
+ * Works exactly like the above method, but returns not a list
+ * of all parts, but a list of empty obtained resolutions.
+ * \return the list of empty resolutions.
+ */
+ MULTIPR_ORB::string_array* decimatePart(
+ const char* pPartName,
+ const char* pFieldName,
+ CORBA::Long pFieldIt,
+ const char* pFilterName,
+ CORBA::Double pTmed,
+ CORBA::Double pTlow,
+ CORBA::Double pRadius)
+ throw (SALOME::SALOME_Exception);
+
/**
* Returns useful information to configure decimation parameters.
* Depends on part, field and filter: generic operation.
const char* pFilterName,
const char* pFilterParams)
throw (SALOME::SALOME_Exception);
-
+
/*!
* Removes all the parts starting with "pPrefixPartName" from the distributed MED file.
* Example: if pPrefixPartName="PART_4" => remove "PART_4" and all sub-parts "PART_4_*", but not "PART41".
*/
void removeParts(const char* pPrefixPartName)
throw (SALOME::SALOME_Exception);
-
+
//---------------------------------------------------------------------
// I/O
//---------------------------------------------------------------------
-
+
/**
* Saves the associated MED file if necessary.
* \param pPath path where to save the file.
* The associated MULTIPR object.
*/
multipr::Obj* mObj;
-
+
/**
* Boxing paremeter: number of cells along each axis.
* E.g. if mBoxing=10 then total number of cells = 10*10*10 = 1000.
* By default, mBoxing=100.
*/
int mBoxing;
-
+
/**
* Engine.
*/
PortableServer::ObjectId* contId,
const char* instanceName,
const char* interfaceName);
-
+
virtual ~MULTIPR_Gen_i();
-
+
char* getVersion()
throw (SALOME::SALOME_Exception);
-
+
void partitionneDomaine(
const char* medFilename,
const char* meshName)
throw (SALOME::SALOME_Exception);
-
+
void partitionneGrain(
const char* medFilename,
const char* partName,
CORBA::Long nbParts,
CORBA::Long partitionner)
throw (SALOME::SALOME_Exception);
-
+
void decimePartition(
const char* medFilename,
const char* partName,
CORBA::Double radius,
CORBA::Long boxing)
throw (SALOME::SALOME_Exception);
-
+
MULTIPR_ORB::MULTIPR_Obj_ptr getObject(const char* medFilename)
throw (SALOME::SALOME_Exception);
void AddToPythonScript (int theStudyID, std::string theString);
private:
- std::string DumpPython_impl (int theStudyID,
- bool isPublished,
+ std::string DumpPython_impl (int theStudyID,
+ bool isPublished,
bool& aValidScript,
std::string theSavedTrace);