X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingIMesh.cxx;h=299986f85ec79c9cfa402eae552ac2c6a707ad53;hb=6b29741613e4edeb511ea88701218f90044bc078;hp=02e629e0f50316d36222ddd5cbef2f47e1bed13d;hpb=30e370a928f879a1c9be2bd685cda6cabec223cf;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingIMesh.cxx b/src/MEDCoupling/MEDCouplingIMesh.cxx index 02e629e0f..299986f85 100644 --- a/src/MEDCoupling/MEDCouplingIMesh.cxx +++ b/src/MEDCoupling/MEDCouplingIMesh.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 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 @@ -28,7 +28,7 @@ #include #include -using namespace ParaMEDMEM; +using namespace MEDCoupling; MEDCouplingIMesh::MEDCouplingIMesh():_space_dim(-1) { @@ -56,7 +56,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::New() MEDCouplingIMesh *MEDCouplingIMesh::New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop, const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop) { - MEDCouplingAutoRefCountObjectPtr ret(new MEDCouplingIMesh); + MCAuto ret(new MEDCouplingIMesh); ret->setName(meshName); ret->setSpaceDimension(spaceDim); ret->setNodeStruct(nodeStrctStart,nodeStrctStop); @@ -65,7 +65,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::New(const std::string& meshName, int spaceDi return ret.retn(); } -MEDCouplingMesh *MEDCouplingIMesh::deepCpy() const +MEDCouplingIMesh *MEDCouplingIMesh::deepCopy() const { return clone(true); } @@ -87,7 +87,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::buildWithGhost(int ghostLev) const { if(ghostLev<0) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::buildWithGhost : the ghostLev must be >= 0 !"); - checkCoherency(); + checkConsistencyLight(); int spaceDim(getSpaceDimension()); double origin[3],dxyz[3]; int structure[3]; @@ -97,7 +97,7 @@ MEDCouplingIMesh *MEDCouplingIMesh::buildWithGhost(int ghostLev) const dxyz[i]=_dxyz[i]; structure[i]=_structure[i]+2*ghostLev; } - MEDCouplingAutoRefCountObjectPtr ret(MEDCouplingIMesh::New(getName(),spaceDim,structure,structure+spaceDim,origin,origin+spaceDim,dxyz,dxyz+spaceDim)); + MCAuto ret(MEDCouplingIMesh::New(getName(),spaceDim,structure,structure+spaceDim,origin,origin+spaceDim,dxyz,dxyz+spaceDim)); ret->copyTinyInfoFrom(this); return ret.retn(); } @@ -170,7 +170,7 @@ std::string MEDCouplingIMesh::getAxisUnit() const */ double MEDCouplingIMesh::getMeasureOfAnyCell() const { - checkCoherency(); + checkConsistencyLight(); int dim(getSpaceDimension()); double ret(1.); for(int i=0;i ret(MEDCouplingCMesh::New()); + checkConsistencyLight(); + MCAuto ret(MEDCouplingCMesh::New()); try { ret->copyTinyInfoFrom(this); } catch(INTERP_KERNEL::Exception& ) { } @@ -196,7 +196,7 @@ MEDCouplingCMesh *MEDCouplingIMesh::convertToCartesian() const std::vector infos(buildInfoOnComponents()); for(int i=0;i arr(DataArrayDouble::New()); arr->alloc(_structure[i],1); arr->setInfoOnComponent(0,infos[i]); + MCAuto arr(DataArrayDouble::New()); arr->alloc(_structure[i],1); arr->setInfoOnComponent(0,infos[i]); arr->iota(); arr->applyLin(_dxyz[i],_origin[i]); ret->setCoordsAt(i,arr); } @@ -213,7 +213,7 @@ void MEDCouplingIMesh::refineWithFactor(const std::vector& factors) { if((int)factors.size()!=_space_dim) throw INTERP_KERNEL::Exception("MEDCouplingIMesh::refineWithFactor : refinement factors must have size equal to spaceDim !"); - checkCoherency(); + checkConsistencyLight(); std::vector structure(_structure,_structure+3); std::vector dxyz(_dxyz,_dxyz+3); for(int i=0;i<_space_dim;i++) @@ -238,11 +238,11 @@ void MEDCouplingIMesh::refineWithFactor(const std::vector& factors) * * \return MEDCouplingIMesh * - A newly created object (to be managed by the caller with decrRef) containing simply one cell. * - * \throw if \a this does not pass the \c checkCoherency test. + * \throw if \a this does not pass the \c checkConsistencyLight test. */ MEDCouplingIMesh *MEDCouplingIMesh::asSingleCell() const { - checkCoherency(); + checkConsistencyLight(); int spaceDim(getSpaceDimension()),nodeSt[3]; double dxyz[3]; for(int i=0;i ret(MEDCouplingIMesh::New(getName(),getSpaceDimension(),nodeSt,nodeSt+spaceDim,_origin,_origin+spaceDim,dxyz,dxyz+spaceDim)); + MCAuto ret(MEDCouplingIMesh::New(getName(),getSpaceDimension(),nodeSt,nodeSt+spaceDim,_origin,_origin+spaceDim,dxyz,dxyz+spaceDim)); ret->copyTinyInfoFrom(this); return ret.retn(); } @@ -923,8 +923,8 @@ void MEDCouplingIMesh::checkDeepEquivalWith(const MEDCouplingMesh *other, int ce } /*! - * Nothing is done here (except to check that the other is a ParaMEDMEM::MEDCouplingIMesh instance too). - * The user intend that the nodes are the same, so by construction of ParaMEDMEM::MEDCouplingIMesh, \a this and \a other are the same ! + * Nothing is done here (except to check that the other is a MEDCoupling::MEDCouplingIMesh instance too). + * The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingIMesh, \a this and \a other are the same ! */ void MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, DataArrayInt *&cellCor) const @@ -933,25 +933,20 @@ void MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *ot throw INTERP_KERNEL::Exception("MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !"); } -void MEDCouplingIMesh::checkCoherency() const +void MEDCouplingIMesh::checkConsistencyLight() const { checkSpaceDimension(); for(int i=0;i<_space_dim;i++) if(_structure[i]<1) { - std::ostringstream oss; oss << "MEDCouplingIMesh::checkCoherency : On axis " << i << "/" << _space_dim << ", number of nodes is equal to " << _structure[i] << " ! must be >=1 !"; + std::ostringstream oss; oss << "MEDCouplingIMesh::checkConsistencyLight : On axis " << i << "/" << _space_dim << ", number of nodes is equal to " << _structure[i] << " ! must be >=1 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } } -void MEDCouplingIMesh::checkCoherency1(double eps) const +void MEDCouplingIMesh::checkConsistency(double eps) const { - checkCoherency(); -} - -void MEDCouplingIMesh::checkCoherency2(double eps) const -{ - checkCoherency1(eps); + checkConsistencyLight(); } void MEDCouplingIMesh::getNodeGridStructure(int *res) const @@ -969,7 +964,7 @@ std::vector MEDCouplingIMesh::getNodeGridStructure() const MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair >& cellPart) const { - checkCoherency(); + checkConsistencyLight(); int dim(getSpaceDimension()); if(dim!=(int)cellPart.size()) { @@ -978,7 +973,7 @@ MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::v } double retOrigin[3]={0.,0.,0.}; int retStruct[3]={0,0,0}; - MEDCouplingAutoRefCountObjectPtr ret(dynamic_cast(deepCpy())); + MCAuto ret(dynamic_cast(deepCopy())); for(int i=0;isetNodeStruct(retStruct,retStruct+dim); ret->setOrigin(retOrigin,retOrigin+dim); - ret->checkCoherency(); + ret->checkConsistencyLight(); return ret.retn(); } @@ -1049,7 +1044,7 @@ std::string MEDCouplingIMesh::advancedRepr() const void MEDCouplingIMesh::getBoundingBox(double *bbox) const { - checkCoherency(); + checkConsistencyLight(); int dim(getSpaceDimension()); for(int idim=0; idim ret(DataArrayDouble::New()); + checkConsistencyLight(); + MCAuto ret(DataArrayDouble::New()); int spaceDim(getSpaceDimension()),nbNodes(getNumberOfNodes()); ret->alloc(nbNodes,spaceDim); double *pt(ret->getPointer()); @@ -1199,10 +1194,10 @@ DataArrayDouble *MEDCouplingIMesh::getCoordinatesAndOwner() const * components. The caller is to delete this array using decrRef() as it is * no more needed. */ -DataArrayDouble *MEDCouplingIMesh::getBarycenterAndOwner() const +DataArrayDouble *MEDCouplingIMesh::computeCellCenterOfMass() const { - checkCoherency(); - MEDCouplingAutoRefCountObjectPtr ret(DataArrayDouble::New()); + checkConsistencyLight(); + MCAuto ret(DataArrayDouble::New()); int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()),tmp[3],tmp2[3]; ret->alloc(nbCells,spaceDim); double *pt(ret->getPointer()),shiftOrigin[3]; @@ -1221,7 +1216,7 @@ DataArrayDouble *MEDCouplingIMesh::getBarycenterAndOwner() const DataArrayDouble *MEDCouplingIMesh::computeIsoBarycenterOfNodesPerCell() const { - return MEDCouplingIMesh::getBarycenterAndOwner(); + return MEDCouplingIMesh::computeCellCenterOfMass(); } void MEDCouplingIMesh::renumberCells(const int *old2NewBg, bool check) @@ -1280,7 +1275,7 @@ void MEDCouplingIMesh::unserialization(const std::vector& tinyInfoD, con void MEDCouplingIMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const { - checkCoherency(); + checkConsistencyLight(); std::ostringstream extent,origin,spacing; for(int i=0;i<3;i++) {