Salome HOME
projects
/
tools
/
medcoupling.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Little refactoring for extractPart.
[tools/medcoupling.git]
/
src
/
MEDLoader
/
SauvMedConvertor.cxx
diff --git
a/src/MEDLoader/SauvMedConvertor.cxx
b/src/MEDLoader/SauvMedConvertor.cxx
index 67e28ed1165844545a95d48adb5124509c965e04..f1542f90cfdc51b2cd94096297575db31bc4b5e1 100644
(file)
--- a/
src/MEDLoader/SauvMedConvertor.cxx
+++ b/
src/MEDLoader/SauvMedConvertor.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
4
CEA/DEN, EDF R&D
+// Copyright (C) 2007-201
5
CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@
-46,11
+46,12
@@
#endif
#ifdef HAS_XDR
#endif
#ifdef HAS_XDR
+#include <rpc/types.h>
#include <rpc/xdr.h>
#endif
using namespace SauvUtilities;
#include <rpc/xdr.h>
#endif
using namespace SauvUtilities;
-using namespace
ParaMEDMEM
;
+using namespace
MEDCoupling
;
namespace
{
namespace
{
@@
-209,7
+210,7
@@
namespace
*/
struct TCellByIDCompare
{
*/
struct TCellByIDCompare
{
- bool operator () (const Cell* i1, const Cell* i2)
+ bool operator () (const Cell* i1, const Cell* i2)
const
{
return i1->_number < i2->_number;
}
{
return i1->_number < i2->_number;
}
@@
-2372,17
+2373,17
@@
Group* IntermediateMED::addNewGroup(std::vector<SauvUtilities::Group*>* groupsTo
//================================================================================
/*!
//================================================================================
/*!
- * \brief Makes
ParaMEDMEM
::MEDFileData from self
+ * \brief Makes
MEDCoupling
::MEDFileData from self
*/
//================================================================================
*/
//================================================================================
-
ParaMEDMEM
::MEDFileData* IntermediateMED::convertInMEDFileDS()
+
MEDCoupling
::MEDFileData* IntermediateMED::convertInMEDFileDS()
{
{
- M
EDCouplingAutoRefCountObjectPtr
< MEDFileUMesh > mesh = makeMEDFileMesh();
- M
EDCouplingAutoRefCountObjectPtr
< MEDFileFields > fields = makeMEDFileFields(mesh);
+ M
CAuto
< MEDFileUMesh > mesh = makeMEDFileMesh();
+ M
CAuto
< MEDFileFields > fields = makeMEDFileFields(mesh);
- M
EDCouplingAutoRefCountObjectPtr
< MEDFileMeshes > meshes = MEDFileMeshes::New();
- M
EDCouplingAutoRefCountObjectPtr
< MEDFileData > medData = MEDFileData::New();
+ M
CAuto
< MEDFileMeshes > meshes = MEDFileMeshes::New();
+ M
CAuto
< MEDFileData > medData = MEDFileData::New();
meshes->pushMesh( mesh );
medData->setMeshes( meshes );
if ( fields ) medData->setFields( fields );
meshes->pushMesh( mesh );
medData->setMeshes( meshes );
if ( fields ) medData->setFields( fields );
@@
-2392,11
+2393,11
@@
ParaMEDMEM::MEDFileData* IntermediateMED::convertInMEDFileDS()
//================================================================================
/*!
//================================================================================
/*!
- * \brief Creates
ParaMEDMEM
::MEDFileUMesh from its data
+ * \brief Creates
MEDCoupling
::MEDFileUMesh from its data
*/
//================================================================================
*/
//================================================================================
-
ParaMEDMEM
::MEDFileUMesh* IntermediateMED::makeMEDFileMesh()
+
MEDCoupling
::MEDFileUMesh* IntermediateMED::makeMEDFileMesh()
{
// check if all needed piles are present
checkDataAvailability();
{
// check if all needed piles are present
checkDataAvailability();
@@
-3091,7
+3092,7
@@
void IntermediateMED::numberElements()
*/
//================================================================================
*/
//================================================================================
-
ParaMEDMEM
::DataArrayDouble * IntermediateMED::getCoords()
+
MEDCoupling
::DataArrayDouble * IntermediateMED::getCoords()
{
DataArrayDouble* coordArray = DataArrayDouble::New();
coordArray->alloc( _nbNodes, _spaceDim );
{
DataArrayDouble* coordArray = DataArrayDouble::New();
coordArray->alloc( _nbNodes, _spaceDim );
@@
-3117,8
+3118,8
@@
ParaMEDMEM::DataArrayDouble * IntermediateMED::getCoords()
*/
//================================================================================
*/
//================================================================================
-void IntermediateMED::setConnectivity(
ParaMEDMEM
::MEDFileUMesh* mesh,
-
ParaMEDMEM
::DataArrayDouble* coords )
+void IntermediateMED::setConnectivity(
MEDCoupling
::MEDFileUMesh* mesh,
+
MEDCoupling
::DataArrayDouble* coords )
{
int meshDim = 0;
{
int meshDim = 0;
@@
-3183,7
+3184,7
@@
void IntermediateMED::setConnectivity( ParaMEDMEM::MEDFileUMesh* mesh,
*/
//================================================================================
*/
//================================================================================
-void IntermediateMED::setGroups(
ParaMEDMEM
::MEDFileUMesh* mesh )
+void IntermediateMED::setGroups(
MEDCoupling
::MEDFileUMesh* mesh )
{
bool isMeshNameSet = false;
const int meshDim = mesh->getMeshDimension();
{
bool isMeshNameSet = false;
const int meshDim = mesh->getMeshDimension();
@@
-3192,7
+3193,7
@@
void IntermediateMED::setGroups( ParaMEDMEM::MEDFileUMesh* mesh )
const int meshDimRelToMaxExt = ( dim == 0 ? 1 : dim - meshDim );
std::vector<const DataArrayInt *> medGroups;
const int meshDimRelToMaxExt = ( dim == 0 ? 1 : dim - meshDim );
std::vector<const DataArrayInt *> medGroups;
- std::vector<M
EDCouplingAutoRefCountObjectPtr
<DataArrayInt> > refGroups;
+ std::vector<M
CAuto
<DataArrayInt> > refGroups;
for ( size_t i = 0; i < _groups.size(); ++i )
{
Group& grp = _groups[i];
for ( size_t i = 0; i < _groups.size(); ++i )
{
Group& grp = _groups[i];
@@
-3265,10
+3266,13
@@
void IntermediateMED::setGroups( ParaMEDMEM::MEDFileUMesh* mesh )
// Issue 0021311. Use case: a gibi group has references (recorded in pile 1)
// and several names (pile 27) refer (pile 10) to this group.
// We create a copy of this group per each named reference
// Issue 0021311. Use case: a gibi group has references (recorded in pile 1)
// and several names (pile 27) refer (pile 10) to this group.
// We create a copy of this group per each named reference
+ std::set<std::string> uniqueNames;
+ uniqueNames.insert( grp._name );
for ( unsigned iRef = 0 ; iRef < grp._refNames.size(); ++iRef )
for ( unsigned iRef = 0 ; iRef < grp._refNames.size(); ++iRef )
- if ( !grp._refNames[ iRef ].empty() )
+ if ( !grp._refNames[ iRef ].empty() &&
+ uniqueNames.insert( grp._refNames[ iRef ]).second ) // for name uniqueness (23155)
{
{
- refGroups.push_back( grp._medGroup->deepCpy() );
+ refGroups.push_back( grp._medGroup->deepC
o
py() );
refGroups.back()->setName( grp._refNames[ iRef ].c_str() );
medGroups.push_back( refGroups.back() );
}
refGroups.back()->setName( grp._refNames[ iRef ].c_str() );
medGroups.push_back( refGroups.back() );
}
@@
-3319,7
+3323,7
@@
bool IntermediateMED::isOnAll( const Group* grp, int & dimRel ) const
*/
//================================================================================
*/
//================================================================================
-
ParaMEDMEM::MEDFileFields * IntermediateMED::makeMEDFileFields(ParaMEDMEM
::MEDFileUMesh* mesh)
+
MEDCoupling::MEDFileFields * IntermediateMED::makeMEDFileFields(MEDCoupling
::MEDFileUMesh* mesh)
{
if ( _nodeFields.empty() && _cellFields.empty() ) return 0;
{
if ( _nodeFields.empty() && _cellFields.empty() ) return 0;
@@
-3345,8
+3349,8
@@
ParaMEDMEM::MEDFileFields * IntermediateMED::makeMEDFileFields(ParaMEDMEM::MEDFi
//================================================================================
void IntermediateMED::setFields( SauvUtilities::DoubleField* fld,
//================================================================================
void IntermediateMED::setFields( SauvUtilities::DoubleField* fld,
-
ParaMEDMEM
::MEDFileFields* medFields,
-
ParaMEDMEM
::MEDFileUMesh* mesh,
+
MEDCoupling
::MEDFileFields* medFields,
+
MEDCoupling
::MEDFileUMesh* mesh,
const TID castemID,
std::set< std::string >& usedFieldNames)
{
const TID castemID,
std::set< std::string >& usedFieldNames)
{
@@
-3405,9
+3409,9
@@
void IntermediateMED::setFields( SauvUtilities::DoubleField* fld,
//================================================================================
void IntermediateMED::setTS( SauvUtilities::DoubleField* fld,
//================================================================================
void IntermediateMED::setTS( SauvUtilities::DoubleField* fld,
-
ParaMEDMEM
::DataArrayDouble* values,
-
ParaMEDMEM
::MEDFileFields* medFields,
-
ParaMEDMEM
::MEDFileUMesh* mesh,
+
MEDCoupling
::DataArrayDouble* values,
+
MEDCoupling
::MEDFileFields* medFields,
+
MEDCoupling
::MEDFileUMesh* mesh,
const int iSub)
{
// treat a field support
const int iSub)
{
// treat a field support
@@
-3429,25
+3433,25
@@
void IntermediateMED::setTS( SauvUtilities::DoubleField* fld,
// set the mesh
if ( onAll )
{
// set the mesh
if ( onAll )
{
- M
EDCouplingAutoRefCountObjectPtr
+ M
CAuto
< MEDCouplingUMesh > dimMesh = mesh->getMeshAtLevel( dimRel );
timeStamp->setMesh( dimMesh );
}
< MEDCouplingUMesh > dimMesh = mesh->getMeshAtLevel( dimRel );
timeStamp->setMesh( dimMesh );
}
- else if ( timeStamp->getTypeOfField() ==
ParaMEDMEM
::ON_NODES )
+ else if ( timeStamp->getTypeOfField() ==
MEDCoupling
::ON_NODES )
{
DataArrayDouble * coo = mesh->getCoords();
{
DataArrayDouble * coo = mesh->getCoords();
- M
EDCouplingAutoRefCountObjectPtr
+ M
CAuto
<DataArrayDouble> subCoo = coo->selectByTupleId(support->_medGroup->begin(),
support->_medGroup->end());
<DataArrayDouble> subCoo = coo->selectByTupleId(support->_medGroup->begin(),
support->_medGroup->end());
- M
EDCouplingAutoRefCountObjectPtr
< MEDCouplingUMesh > nodeSubMesh =
+ M
CAuto
< MEDCouplingUMesh > nodeSubMesh =
MEDCouplingUMesh::Build0DMeshFromCoords( subCoo );
timeStamp->setMesh( nodeSubMesh );
}
else
{
MEDCouplingUMesh::Build0DMeshFromCoords( subCoo );
timeStamp->setMesh( nodeSubMesh );
}
else
{
- M
EDCouplingAutoRefCountObjectPtr
+ M
CAuto
< MEDCouplingUMesh > dimMesh = mesh->getMeshAtLevel( dimRel );
< MEDCouplingUMesh > dimMesh = mesh->getMeshAtLevel( dimRel );
- M
EDCouplingAutoRefCountObjectPtr
+ M
CAuto
<MEDCouplingMesh> subMesh = dimMesh->buildPart(support->_medGroup->begin(),
support->_medGroup->end());
timeStamp->setMesh( subMesh);
<MEDCouplingMesh> subMesh = dimMesh->buildPart(support->_medGroup->begin(),
support->_medGroup->end());
timeStamp->setMesh( subMesh);
@@
-3458,7
+3462,7
@@
void IntermediateMED::setTS( SauvUtilities::DoubleField* fld,
timeStamp->setArray( values );
values->decrRef();
// set gauss points
timeStamp->setArray( values );
values->decrRef();
// set gauss points
- if ( timeStamp->getTypeOfField() ==
ParaMEDMEM
::ON_GAUSS_PT )
+ if ( timeStamp->getTypeOfField() ==
MEDCoupling
::ON_GAUSS_PT )
{
TGaussDef gaussDef( fld->_sub[iSub]._support->_cellType,
fld->_sub[iSub].nbGauss() );
{
TGaussDef gaussDef( fld->_sub[iSub]._support->_cellType,
fld->_sub[iSub].nbGauss() );
@@
-3481,7
+3485,7
@@
void IntermediateMED::setTS( SauvUtilities::DoubleField* fld,
timeStamp->setOrder( nbTS );
// add the time-stamp
timeStamp->setOrder( nbTS );
// add the time-stamp
- timeStamp->checkCo
herency
();
+ timeStamp->checkCo
nsistencyLight
();
if ( onAll )
fld->_curMedField->appendFieldNoProfileSBT( timeStamp );
else
if ( onAll )
fld->_curMedField->appendFieldNoProfileSBT( timeStamp );
else
@@
-3655,7
+3659,7
@@
bool DoubleField::hasSameComponentsBySupport() const
*/
//================================================================================
*/
//================================================================================
-
ParaMEDMEM
::TypeOfField DoubleField::getMedType( const int iSub ) const
+
MEDCoupling
::TypeOfField DoubleField::getMedType( const int iSub ) const
{
using namespace INTERP_KERNEL;
{
using namespace INTERP_KERNEL;
@@
-3677,7
+3681,7
@@
ParaMEDMEM::TypeOfField DoubleField::getMedType( const int iSub ) const
*/
//================================================================================
*/
//================================================================================
-
ParaMEDMEM
::TypeOfTimeDiscretization DoubleField::getMedTimeDisc() const
+
MEDCoupling
::TypeOfTimeDiscretization DoubleField::getMedTimeDisc() const
{
return ONE_TIME;
// NO_TIME = 4,
{
return ONE_TIME;
// NO_TIME = 4,