X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileJoint.cxx;h=a1ed652a702e9f9ff53e858b992982964589860d;hb=d5f2b9cd2ec721b8411ed143dee57234e576c369;hp=5763ca2f771d1113bc32e1fd78b49b901462df6c;hpb=3b1d77efdd048ef4aad858e96138bf79318119df;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileJoint.cxx b/src/MEDLoader/MEDFileJoint.cxx index 5763ca2f7..a1ed652a7 100644 --- a/src/MEDLoader/MEDFileJoint.cxx +++ b/src/MEDLoader/MEDFileJoint.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D +// Copyright (C) 2007-2019 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 @@ -18,7 +18,6 @@ // #include "MEDFileJoint.hxx" -#include "MEDFileUtilities.hxx" #include "MEDLoader.hxx" #include "MEDLoaderBase.hxx" #include "MEDFileSafeCaller.txx" @@ -358,7 +357,7 @@ bool MEDFileJointOneStep::isEqual(const MEDFileJointOneStep *other) const if ( getNumberOfCorrespondences() != other->getNumberOfCorrespondences() ) return false; - std::vector found( getNumberOfCorrespondences(), false ); + std::vector found( getNumberOfCorrespondences(), false ); for(int i=0; i); @@ -495,33 +496,13 @@ MEDFileJoint::MEDFileJoint(med_idt fid, const std::string& mName, int curJoint) } } -/*! - * Writes \a this joint into a MED file specified by its name. - * \param [in] fileName - the MED file name. - * \param [in] mode - the writing mode. For more on \a mode, see \ref AdvMEDLoaderBasics. - * - 2 - erase; an existing file is removed. - * - 1 - append; same data should not be present in an existing file. - * - 0 - overwrite; same data present in an existing file is overwritten. - * \throw If the mesh name is not set. - * \throw If \a mode == 1 and the same data is present in an existing file. - */ -void MEDFileJoint::write(const std::string& fileName, int mode) const -{ - med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); - std::ostringstream oss; oss << "MEDFileJoint : error on attempt to write in file : \"" << fileName << "\""; - MEDFileUtilities::CheckMEDCode(fid,fid,oss.str()); - write(fid); -} - -void MEDFileJoint::write(med_idt fid) const +void MEDFileJoint::writeLL(med_idt fid) const { // if ( _loc_mesh_name.empty() ) // throw INTERP_KERNEL::Exception("MEDFileJoint::write : name of a local mesh not defined!"); MEDFILESAFECALLERWR0(MEDsubdomainJointCr,(fid,getLocalMeshName().c_str(),getJointName().c_str(),getDescription().c_str(),getDomainNumber(),getRemoteMeshName().c_str())); - for(std::vector< MCAuto >::const_iterator it=_joint.begin();it!=_joint.end();it++) { + for(std::vector< MCAuto >::const_iterator it=_joint.begin();it!=_joint.end();it++) (*it)->writeLL(fid, getLocalMeshName(),getJointName()); - } } void MEDFileJoint::pushStep(MEDFileJointOneStep* step) @@ -566,20 +547,22 @@ bool MEDFileJoint::isEqual(const MEDFileJoint *other) const return false; if(_domain_number!=other->_domain_number) return false; - std::vector found( getNumberOfSteps(), false ); - for(int i=0; igetNumberOfSteps()) + return false; + std::vector found(nbTS,false); + for(int i=0;iisEqual(other->getStepAtPos(j))) + if(!found[j] && getStepAtPos(i)->isEqual(other->getStepAtPos(j))) { - found[ j ] = true; + found[j]=true; break; } } - if ( j == getNumberOfSteps() ) + if(j==nbTS) return false; } return true; @@ -654,21 +637,10 @@ MEDFileJoints *MEDFileJoints::New(med_idt fid, const std::string& meshName) return new MEDFileJoints( fid, meshName ); } -void MEDFileJoints::write(med_idt fid) const +void MEDFileJoints::writeLL(med_idt fid) const { for(std::vector< MCAuto >::const_iterator it=_joints.begin();it!=_joints.end();it++) - { - (*it)->write(fid); - } -} - -void MEDFileJoints::write(const std::string& fileName, int mode) const -{ - med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode); - MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod); - std::ostringstream oss; oss << "MEDFileJoints : error on attempt to write in file : \"" << fileName << "\""; - MEDFileUtilities::CheckMEDCode(fid,fid,oss.str()); - write(fid); + (*it)->writeLL(fid); } std::string MEDFileJoints::getMeshName() const