Version: 5.1.6

multipr.MeshDis Class Reference

#include <MULTIPR_MeshDis.hxx>

Public Member Functions

 MeshDis ()
 Builds an empty mesh (default constructor).
 ~MeshDis ()
 Destructor.
void reset ()
 Resets this object in its state by default (empty).
void setSequentialMEDFilename (const char *pFilename)
 Sets the name of the associated sequential MED file (=original MED file).
const char * getSequentialMEDFilename () const
 Returns the name of this sequential MED file (=original MED file).
const char * getDistributedMEDFilename () const
 Returns the name of this distributed MED file (=name of the master file).
void addMesh (MeshDisPart::OnNextWrite pToDoOnNextWrite, const char *pMeshName, int pId, const char *pPartName, const char *pPath, const char *pMEDFileName, Mesh *pMesh)
 Adds a new part to this distributed mesh.
void insertMesh (MeshDisPart::OnNextWrite pToDoOnNextWrite, const char *pMeshName, int pId, const char *pPartName, const char *pPath, const char *pMEDFileName, Mesh *pMesh, int pPosition)
 Inserts a new part to this distributed mesh.
void removeParts (const char *pPrefixPartName)
 Removes all the part beginning by pPrefixPartName from this distributed mesh.
int getNumParts () const
 Returns the current number of parts in this distributed mesh.
MeshDisPartgetPart (int pIndex) const
 Returns the nth part of this distributed mesh.
std::vector< std::string > getMeshes () const
 Returns the list of meshes contained in this distributed MED file.
std::vector< std::string > getFields (const char *pPartList, bool pAddNbGaussPoint=false) const
 Returns the list of fields contained in this distributed MED file.
int getTimeStamps (const char *pPartList, const char *pFieldName) const
 Returns the number of iteration for a given field.
std::string getPartInfo (const char *pPartName)
 Returns all information about a part.
MeshDisPartfindPart (const char *pPartName)
 Finds a part of this distributed mesh by its name.
void splitPart (const char *pPartName, int pNbParts, int pPartitionner)
 Updates this distributed mesh by splitting one of its part.
std::list< std::string > decimatePart (const char *pPartName, const char *pFieldName, med_int pFieldIt, const char *pFilterName, const char *pFilterParams)
 Creates 3 resolution (CURRENT = FULL, MEDIUM and LOW) of a part of this distributed mesh.
std::string evalDecimationParams (const char *pPartName, const char *pFieldName, int pFieldIt, const char *pFilterName, const char *pFilterParams)
 Returns useful information to configure decimation parameters.
std::string & getDecimationStatistics ()
 Get the statistics of the last decimation.
void readDistributedMED (const char *pMEDfilename)
 Reads the master file of a distributed MED file.
void readPersistentDistributedMED (const char *pMEDfilename)
 Works like readDistributedMED(), but assumes that the distributed MED file was moved from the original location and its ASCII master file needs to be updated.
void writeDistributedMED (const char *pMEDfilenamePrefix, bool pIsPersistence=false)
 Writes this distributed MED file (including master file and sub MED files if necessary).
void setProgress (int pPercents)
 Update save progress.
int getProgress ()
 Obtain save progress.
void readAndWriteFields (const char *pMeshName, std::vector< Group * > *pGroups, GaussIndexList *pGaussList, std::vector< Profil * > &pProfils)
 Read and write the fields for optimized domain split.
int computeNumParts ()
 Recomputes the number of parts in this distributed mesh.
 MeshDis (const MeshDis &)
MeshDisoperator= (const MeshDis &)
bool operator== (const MeshDis &)

Data Fields

char mSequentialMEDFilename [256]
 Name of the original MED file used to build distribyuted MED.
char mDistributedMEDFilename [256]
 Name of this distributed MED file (= name of the master file).
std::vector< MeshDisPart * > mParts
 Table of sub-parts; a distributed mesh is composed of N sub-part, where N = mParts.size().
std::string mStats
 Statistics of the last decimation.
int mWriteProgress
 Mesh saving progress in percents.
boost::recursive_mutex mWriteMutex
 For thread-safe access to mWriteProgress.

Friends

std::ostream & operator<< (std::ostream &pOs, MeshDis &pM)
 Dumps any MeshDis to the given output stream.

Constructor & Destructor Documentation

multipr.MeshDis::MeshDis (  ) 

Builds an empty mesh (default constructor).

References multipr.MeshDis.reset().

multipr.MeshDis::~MeshDis (  ) 

Destructor.

Removes everything.

References multipr.MeshDis.reset().

multipr.MeshDis.MeshDis ( const MeshDis  ) 

Member Function Documentation

void multipr.MeshDis::reset (  ) 
void multipr.MeshDis::setSequentialMEDFilename ( const char *  pFilename  ) 

Sets the name of the associated sequential MED file (=original MED file).

Parameters:
pFilename name of the associated sequential MED file.

References multipr.MeshDis.mSequentialMEDFilename.

const char* multipr.MeshDis.getSequentialMEDFilename (  )  const

Returns the name of this sequential MED file (=original MED file).

Returns:
the name of this sequential MED file (=original MED file).

References multipr.MeshDis.mSequentialMEDFilename.

const char* multipr.MeshDis.getDistributedMEDFilename (  )  const

Returns the name of this distributed MED file (=name of the master file).

Returns:
the name of this distributed MED file (=name of the master file).

References multipr.MeshDis.mDistributedMEDFilename.

void multipr.MeshDis::addMesh ( MeshDisPart::OnNextWrite  pToDoOnNextWrite,
const char *  pMeshName,
int  pId,
const char *  pPartName,
const char *  pPath,
const char *  pMEDFileName,
Mesh pMesh 
)

Adds a new part to this distributed mesh.

Used by the split process (extract groups).

Parameters:
pToDoOnNextWrite 
pMeshName 
pId 
pPartName 
pPath 
pMEDFileName 
pMesh can be NULL.

References multipr.MeshDisPart.create(), and multipr.MeshDis.mParts.

void multipr.MeshDis::insertMesh ( MeshDisPart::OnNextWrite  pToDoOnNextWrite,
const char *  pMeshName,
int  pId,
const char *  pPartName,
const char *  pPath,
const char *  pMEDFileName,
Mesh pMesh,
int  pPosition 
)

Inserts a new part to this distributed mesh.

Used by the decimation process.

Parameters:
pToDoOnNextWrite 
pMeshName 
pId 
pPartName 
pPath 
pMEDFileName 
pMesh can be NULL.
pPosition insert after this position. Start at 1.

References multipr.MeshDisPart.create(), and multipr.MeshDis.mParts.

void multipr.MeshDis::removeParts ( const char *  pPrefixPartName  ) 

Removes all the part beginning by pPrefixPartName from this distributed mesh.

Example: if pPrefixPartName="PART_4" => remove "PART_4" and all sub-parts "PART_4_*", but not "PART41".

Parameters:
pPrefixPartName name of the part.

References multipr.MeshDisPart.getPartName(), multipr.MeshDisPart.mMEDFileName, multipr.MeshDis.mParts, NULL, and multipr.startsWith().

int multipr.MeshDis.getNumParts (  )  const

Returns the current number of parts in this distributed mesh.

Returns:
the current number of parts in this distributed mesh.

References multipr.MeshDis.mParts.

MeshDisPart* multipr.MeshDis.getPart ( int  pIndex  )  const

Returns the nth part of this distributed mesh.

Parameters:
pIndex index of the part (in 0..getNumParts()-1).
Returns:
the nth part of this distributed mesh.

References multipr.MeshDis.mParts.

vector< string > multipr.MeshDis::getMeshes (  )  const

Returns the list of meshes contained in this distributed MED file.

Returns:
the list of meshes contained in this distributed MED file.

References multipr.MeshDisPart.getMeshName(), Med_Gen_test.meshName, and multipr.MeshDis.mParts.

vector< string > multipr.MeshDis::getFields ( const char *  pPartList,
bool  pAddNbGaussPoint = false 
) const

Returns the list of fields contained in this distributed MED file.

Parameters:
pPartList The list of parts to get the fields from (separator is '|').
pAddNbGaussPoint If set to true, the number of gauss point of each field is added.
Returns:
the list of fields contained in this distributed MED file.

References multipr.getListScalarFields(), multipr.MeshDisPart.getMEDFileName(), multipr.MeshDisPart.getMeshName(), multipr.Mesh.getNameScalarFields(), multipr.MeshDisPart.mMesh, multipr.MeshDis.mParts, multipr.MeshDisPart.mToDoOnNextWrite, multipr.MeshDisPart.MULTIPR_KEEP_AS_IT, multipr.MeshDisPart.MULTIPR_WRITE_MESH, multipr.MeshDisPart.MULTIPR_WRITE_PARTS, and NULL.

int multipr.MeshDis::getTimeStamps ( const char *  pPartList,
const char *  pFieldName 
) const

Returns the number of iteration for a given field.

Parameters:
pPartList The list of parts to get the fields from (separator is '|').
pFieldName field name.
Returns:
the number of iteration for a given field.

References multipr.getListScalarFields(), multipr.MeshDisPart.getMEDFileName(), multipr.MeshDis.mParts, multipr.MeshDisPart.MULTIPR_KEEP_AS_IT, multipr.MeshDisPart.MULTIPR_WRITE_MESH, multipr.MeshDisPart.MULTIPR_WRITE_PARTS, and NULL.

string multipr.MeshDis::getPartInfo ( const char *  pPartName  ) 

Returns all information about a part.

Parameters:
pPartName name of the part.
Returns:
all information about a part.

References multipr.MeshDis.findPart(), multipr.MeshDisPart.mId, multipr.MeshDisPart.mMEDFileName, multipr.MeshDisPart.mMeshName, multipr.MeshDisPart.mPartName, multipr.MeshDisPart.mPath, and NULL.

MeshDisPart * multipr.MeshDis::findPart ( const char *  pPartName  ) 

Finds a part of this distributed mesh by its name.

Returns NULL if the part does not exist.

Parameters:
pPartName part to be found; must not be NULL.
Returns:
a pointer towards the part if it exists, NULL otherwise.
Exceptions:
NullArgumentException if pPartName is NULL.

References multipr.MeshDisPart.getPartName(), multipr.MeshDis.mParts, and NULL.

void multipr.MeshDis::splitPart ( const char *  pPartName,
int  pNbParts,
int  pPartitionner 
)

Updates this distributed mesh by splitting one of its part.

This splitting method leans on medsplitter, by V. Bergeaud (CEA).

Parameters:
pPartName name of the part to be splitted.
pNbParts number of sub-parts.
pPartitionner MULTIPR_METIS or MULTIPR_SCOTCH.
Exceptions:
RuntimeException if any error occurs.

References test_MEDSPLITTER.collection, MEDSPLITTER.MESHCollection.createPartition(), multipr.MeshDis.findPart(), multipr.MeshDisPart.getMEDFileName(), multipr.MeshDisPart.getMeshName(), multipr.MeshDisPart.mCollection, MEDSPLITTER.MedAscii, MEDSPLITTER.Graph.METIS, multipr.MeshDisPart.mOldCollection, multipr.MeshDisPart.mSplit, multipr.MeshDisPart.mToDoOnNextWrite, multipr.MULTIPR_METIS, multipr.MULTIPR_SCOTCH, multipr.MeshDisPart.MULTIPR_WRITE_PARTS, NULL, MEDSPLITTER.Graph.SCOTCH, and MEDSPLITTER.MESHCollection.setDriverType().

std::list< std::string > multipr.MeshDis::decimatePart ( const char *  pPartName,
const char *  pFieldName,
med_int  pFieldIt,
const char *  pFilterName,
const char *  pFilterParams 
)

Creates 3 resolution (CURRENT = FULL, MEDIUM and LOW) of a part of this distributed mesh.

Names of new meshes are <original_name>_MED and <original_name>_LOW.

Parameters:
pPartName 
pFielName 
pFieldIt 
pFilterName 
pTMed threshold used to generate MEDIUM resolution.
pTLow threshold used to generate LOW resolution (must be >= pTMed).
pRadius 
pBoxing number of cells along each axis; e.g. if 100 then grid will have 100*100*100 = 10**6 cells; 100 by default.
Returns:
a list of strings, containing names of empty resulting parts, empty list if all resolutions are non-empty.
Exceptions:
RuntimeException if any error occurs.

References multipr.Mesh.decimate(), MEDCouplingCorbaSwigTestClt.f, test_NonCoincidentDEC.filename, multipr.MeshDis.findPart(), multipr.MeshDisPart.getMEDFileName(), multipr.MeshDisPart.getMeshName(), multipr.Mesh.getNumberOfElements(), multipr.MeshDis.insertMesh(), MED_TAILLE_NOM, multipr.MeshDisPart.mId, multipr.MeshDisPart.mMesh, multipr.MeshDis.mStats, multipr.MeshDisPart.MULTIPR_WRITE_MESH, NULL, multipr.MeshDisPart.readMED(), multipr.realToString(), multipr.removeExtension(), testMEDMEM.ret, and multipr.Mesh.writeMED().

string multipr.MeshDis::evalDecimationParams ( const char *  pPartName,
const char *  pFieldName,
int  pFieldIt,
const char *  pFilterName,
const char *  pFilterParams 
)

Returns useful information to configure decimation parameters.

Depends on part, field and filter: generic operation.

Parameters:
pPartName name of the part.
pFieldName name of the field used for decimation.
pFieldIt iteration (time step) of the field.
pFilterName name of the filter to be used.
pFilterParams params to be used with the filter (depends on filter; this string will be parsed).
Returns:

References multipr.DecimationFilter.create(), multipr.Mesh.evalDefaultRadius(), multipr.MeshDis.findPart(), multipr.DecimationFilterGradAvg.getGradientInfo(), multipr.MeshDisPart.mMesh, med_test3.mode, NULL, multipr.MeshDisPart.readMED(), and testMEDMEM.ret.

std::string& multipr.MeshDis.getDecimationStatistics (  ) 

Get the statistics of the last decimation.

The format is : "lowres-compression-rate medres-compression-rate".

References multipr.MeshDis.mStats.

void multipr.MeshDis::readDistributedMED ( const char *  pMEDfilename  ) 
void multipr.MeshDis::readPersistentDistributedMED ( const char *  pMEDfilename  ) 

Works like readDistributedMED(), but assumes that the distributed MED file was moved from the original location and its ASCII master file needs to be updated.

Note:
This method is mentioned to be used only in persistence.

References multipr.MeshDis.addMesh(), multipr.getFilenameWithoutPath(), multipr.getPath(), multipr.MeshDis.mDistributedMEDFilename, MED_TAILLE_NOM, multipr.MeshDisPart.MULTIPR_KEEP_AS_IT, NULL, multipr.MeshDis.reset(), testMEDMEM.ret, and multipr.MeshDis.setSequentialMEDFilename().

void multipr.MeshDis::writeDistributedMED ( const char *  pMEDfilenamePrefix,
bool  pIsPersistence = false 
)
void multipr.MeshDis::setProgress ( int  pPercents  ) 

Update save progress.

Parameters:
pPercents current save progress in percents.

References multipr.MeshDis.mWriteMutex, and multipr.MeshDis.mWriteProgress.

int multipr.MeshDis::getProgress (  ) 

Obtain save progress.

Returns:
current save progress in percents.

References multipr.MeshDis.mWriteMutex, multipr.MeshDis.mWriteProgress, and testMEDMEM.ret.

void multipr.MeshDis::readAndWriteFields ( const char *  pMeshName,
std::vector< Group * > *  pGroups,
GaussIndexList pGaussList,
std::vector< Profil * > &  pProfils 
)

Read and write the fields for optimized domain split.

Parameters:
pMeshName The name of the current mesh.
pGroups The groups.
pGaussList The list of gauss index.
pProfils The profiles of the mesh.

References multipr.CELL_TYPES, multipr.eMaxMedMesh, MED_test2.field, multipr.Field.isEmpty(), multipr.Field.isFieldOnNodes(), Med_Gen_test.it, med_2_1.MEDfermer(), med_2_1.MEDnChamp(), med_2_1.MEDouvrir(), multipr.MeshDis.mParts, multipr.MeshDis.mSequentialMEDFilename, MULTIPR_LOG, multipr.Field.readMED(), and multipr.Field.writeMEDOptimized().

int multipr.MeshDis::computeNumParts (  ) 

Recomputes the number of parts in this distributed mesh.

This method is used by writeDistributedMED().

Returns:
the number of parts in this distributed mesh.

References multipr.MeshDis.mParts, multipr.MeshDisPart.MULTIPR_KEEP_AS_IT, multipr.MeshDisPart.MULTIPR_WRITE_MESH, and multipr.MeshDisPart.MULTIPR_WRITE_PARTS.

MeshDis& multipr.MeshDis.operator= ( const MeshDis  ) 
bool multipr.MeshDis.operator== ( const MeshDis  ) 

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  pOs,
MeshDis pM 
) [friend]

Dumps any MeshDis to the given output stream.

Parameters:
pOs any output stream.
pM any MeshDis.
Returns:
the output stream pOs.

Field Documentation

Name of the original MED file used to build distribyuted MED.

Name of this distributed MED file (= name of the master file).

Table of sub-parts; a distributed mesh is composed of N sub-part, where N = mParts.size().

Statistics of the last decimation.

Mesh saving progress in percents.

boost::recursive_mutex multipr.MeshDis.mWriteMutex

For thread-safe access to mWriteProgress.