-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016 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
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "SauvReader.hxx"
#include "SauvMedConvertor.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
#include "NormalizedUnstructuredMesh.hxx"
#include "MEDCouplingRefCountObject.hxx"
#include <sstream>
#include <iostream>
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
using namespace SauvUtilities;
using namespace std;
*/
//================================================================================
-SauvReader* SauvReader::New(const char *fileName)
+SauvReader* SauvReader::New(const std::string& fileName)
{
- if ( !fileName || strlen(fileName) < 1 ) THROW_IK_EXCEPTION("Invalid file name");
+ if ( fileName.empty() ) THROW_IK_EXCEPTION("Invalid file name");
- ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr< SauvUtilities::FileReader> parser;
+ MEDCoupling::MCAuto< SauvUtilities::FileReader> parser;
// try to open as XRD
- parser = new XDRReader( fileName );
+ parser = new XDRReader( fileName.c_str() );
if ( parser->open() )
{
SauvReader* reader = new SauvReader;
}
// try to open as ASCII
- parser = new ASCIIReader( fileName );
+ parser = new ASCIIReader( fileName.c_str() );
if ( parser->open() )
{
SauvReader* reader = new SauvReader;
return 0;
}
-std::vector<const BigMemoryObject *> SauvReader::getDirectChildren() const
+std::vector<const BigMemoryObject *> SauvReader::getDirectChildrenWithNull() const
{
return std::vector<const BigMemoryObject *>();
}
*/
//================================================================================
-ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS()
+MEDCoupling::MEDFileData * SauvReader::loadInMEDFileDS()
{
SauvUtilities::IntermediateMED iMed; // intermadiate DS
_iMed = &iMed;
THROW_IK_EXCEPTION("XDR : ENREGISTREMENT DE TYPE " << recordNumber << " not implemented!!!");
}
- ParaMEDMEM::MEDFileData* medFileData = iMed.convertInMEDFileDS();
+ MEDCoupling::MEDFileData* medFileData = iMed.convertInMEDFileDS();
return medFileData;
}
else
for (initIntReading(nbElements); more(); next());
- // not a composit group
+ // not a composite group
if (castemCellType>0 && nbSubGroups==0)
{
group._cellType = SauvUtilities::gibi2medGeom(castemCellType);
SauvUtilities::Group & grp = _iMed->_groups[ grpID-1 ];
if ( !grp._name.empty() ) // a group has several names
{ // create a group with subgroup grp and named grp.name
- _iMed->_groups.push_back(Group());
- _iMed->_groups.back()._groups.push_back( &_iMed->_groups[ grpID-1 ]);
- _iMed->_groups.back()._name = grp._name;
+ SauvUtilities::Group* newGroup = _iMed->addNewGroup();
+ newGroup->_groups.push_back( &_iMed->_groups[ grpID-1 ]);
+ newGroup->_name = grp._name;
}
grp._name=objectNames[i];
#ifdef _DEBUG
//================================================================================
/*!
- * \brief Finds or create a Group equal to a given field support
+ * \brief Find or create a Group equal to a given field support
*/
//================================================================================
{
SauvUtilities::Group* group = NULL;
set<SauvUtilities::Group*> sup_set( supports.begin(), supports.end() );
- if (sup_set.size() == 1 ) // one or equal supports
+ if ( sup_set.size() == 1 ) // one or equal supports
{
group = supports[0];
}
sameOrder = ( supports[j] == newGroups[ j % newGroups.size() ]);
if ( sameOrder )
{
- _iMed->_groups.push_back( SauvUtilities::Group() );
- group = & _iMed->_groups.back();
+ group = _iMed->addNewGroup( & newGroups );
group->_groups.swap( newGroups );
}
}
// relocate sub-components according to a new order of groups
if ( isModified )
{
- vector< DoubleField::_Sub_data > newSub( field->_sub.size() );
+ vector< DoubleField::_Sub_data > newSub ( field->_sub.size() );
vector< vector< double > > newValues( field->_comp_values.size() );
size_t iFromSub = 0, iNewSub = 0, iNewComp = 0;
for ( ; iFromSub < field->_sub.size(); iFromSub += groups.size() )