From f588b81ec040f56b04a916a1ef5e6912d4f2d824 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Wed, 24 Aug 2016 14:26:21 +0200 Subject: [PATCH] End of simplification of API of MEDFileIntField1TS and MEDFileIntFieldMultiTS --- .../Bases/InterpKernelException.cxx | 4 + .../Bases/InterpKernelException.hxx | 1 + src/MEDCoupling/MEDCouplingFieldDouble.cxx | 12 +- src/MEDCoupling/MEDCouplingUMesh.cxx | 134 +++---- src/MEDLoader/MEDFileField.cxx | 333 +++++++----------- src/MEDLoader/MEDFileField.hxx | 14 +- src/MEDLoader/Swig/MEDLoaderCommon.i | 63 +--- src/MEDLoader/Swig/MEDLoaderTest3.py | 26 +- 8 files changed, 225 insertions(+), 362 deletions(-) diff --git a/src/INTERP_KERNEL/Bases/InterpKernelException.cxx b/src/INTERP_KERNEL/Bases/InterpKernelException.cxx index 0560aff74..110fd7ba5 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelException.cxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelException.cxx @@ -24,6 +24,10 @@ INTERP_KERNEL::Exception::Exception(const char *reason):_reason(reason) { } +INTERP_KERNEL::Exception::Exception(const std::string& reason):_reason(reason) +{ +} + INTERP_KERNEL::Exception::Exception(const char *reason, const char *file, int line):_reason(reason) { } diff --git a/src/INTERP_KERNEL/Bases/InterpKernelException.hxx b/src/INTERP_KERNEL/Bases/InterpKernelException.hxx index 8d68ab69c..d165bfe82 100644 --- a/src/INTERP_KERNEL/Bases/InterpKernelException.hxx +++ b/src/INTERP_KERNEL/Bases/InterpKernelException.hxx @@ -32,6 +32,7 @@ namespace INTERP_KERNEL { public: INTERPKERNEL_EXPORT Exception(const char *reason); + INTERPKERNEL_EXPORT Exception(const std::string& reason); INTERPKERNEL_EXPORT Exception(const char *reason, const char *file, int line); INTERPKERNEL_EXPORT ~Exception() throw (); INTERPKERNEL_EXPORT const char *what() const throw(); diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index 8afb7a54f..0ca5c3476 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -233,7 +233,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const else { std::ostringstream oss; oss << "MEDCouplingFieldDouble::nodeToCellDiscretization : Cell id #" << i << " has been detected to have no nodes !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -939,7 +939,7 @@ double MEDCouplingFieldDouble::getWeightedAverageValue(int compId, bool isWAbs) if(compId<0 || compId>=nbComps) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::getWeightedAverageValue : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } INTERP_KERNEL::AutoPtr res=new double[nbComps]; getWeightedAverageValue(res,isWAbs); @@ -967,7 +967,7 @@ double MEDCouplingFieldDouble::normL1(int compId) const if(compId<0 || compId>=nbComps) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL1 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } INTERP_KERNEL::AutoPtr res=new double[nbComps]; _type->normL1(_mesh,getArray(),res); @@ -1014,7 +1014,7 @@ double MEDCouplingFieldDouble::normL2(int compId) const if(compId<0 || compId>=nbComps) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::normL2 : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } INTERP_KERNEL::AutoPtr res=new double[nbComps]; _type->normL2(_mesh,getArray(),res); @@ -1064,7 +1064,7 @@ double MEDCouplingFieldDouble::integral(int compId, bool isWAbs) const if(compId<0 || compId>=nbComps) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::integral : Invalid compId specified : No such nb of components ! Should be in [0," << nbComps << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } INTERP_KERNEL::AutoPtr res=new double[nbComps]; _type->integral(_mesh,getArray(),isWAbs,res); @@ -3030,7 +3030,7 @@ std::string MEDCouplingFieldDouble::WriteVTK(const std::string& fileName, const if(name.empty()) { std::ostringstream oss; oss << "MEDCouplingFieldDouble::WriteVTK : Field in pos #" << i << " has no name !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } TypeOfField typ=cur->getTypeOfField(); if(typ==ON_CELLS) diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index f7f960cec..38da9fe17 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -236,7 +236,7 @@ void MEDCouplingUMesh::checkConsistency(double eps) const { std::ostringstream oss; oss << "MEDCouplingUMesh::checkConsistency : cell << #" << i<< " with type Type " << cm.getRepr() << " in 'this' whereas meshdim == " << meshDim << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int nbOfNodesInCell=ptrI[i+1]-ptrI[i]-1; if(!cm.isDynamic()) @@ -245,7 +245,7 @@ void MEDCouplingUMesh::checkConsistency(double eps) const std::ostringstream oss; oss << "MEDCouplingUMesh::checkConsistency : cell #" << i << " with static Type '" << cm.getRepr() << "' has " << cm.getNumberOfNodes(); oss << " nodes whereas in connectivity there is " << nbOfNodesInCell << " nodes ! Looks very bad !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(cm.isQuadratic() && cm.isDynamic() && meshDim == 2) if (nbOfNodesInCell % 2 || nbOfNodesInCell < 4) @@ -253,7 +253,7 @@ void MEDCouplingUMesh::checkConsistency(double eps) const std::ostringstream oss; oss << "MEDCouplingUMesh::checkConsistency : cell #" << i << " with quadratic type '" << cm.getRepr() << "' has " << nbOfNodesInCell; oss << " nodes. This should be even, and greater or equal than 4!! Looks very bad!"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } for(const int *w=ptr+ptrI[i]+1;w!=ptr+ptrI[i+1];w++) { @@ -263,20 +263,20 @@ void MEDCouplingUMesh::checkConsistency(double eps) const if(nodeId>=nbOfNodes) { std::ostringstream oss; oss << "Cell #" << i << " is built with node #" << nodeId << " whereas there are only " << nbOfNodes << " nodes in the mesh !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } else if(nodeId<-1) { std::ostringstream oss; oss << "Cell #" << i << " is built with node #" << nodeId << " in connectivity ! sounds bad !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } else { if((INTERP_KERNEL::NormalizedCellType)(ptr[ptrI[i]])!=INTERP_KERNEL::NORM_POLYHED) { std::ostringstream oss; oss << "Cell #" << i << " is built with node #-1 in connectivity ! sounds bad !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -355,7 +355,7 @@ void MEDCouplingUMesh::insertNextCell(INTERP_KERNEL::NormalizedCellType type, in { std::ostringstream oss; oss << "MEDCouplingUMesh::insertNextCell : Trying to push a " << cm.getRepr() << " cell with a size of " << size; oss << " ! Expecting " << cm.getNumberOfNodes() << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int idx=_nodal_connec_index->back(); int val=idx+size+1; @@ -368,7 +368,7 @@ void MEDCouplingUMesh::insertNextCell(INTERP_KERNEL::NormalizedCellType type, in std::ostringstream oss; oss << "MEDCouplingUMesh::insertNextCell : cell type " << cm.getRepr() << " has a dimension " << cm.getDimension(); oss << " whereas Mesh Dimension of current UMesh instance is set to " << _mesh_dim << " ! Please invoke \"setMeshDimension\" method before or invoke "; oss << "\"MEDCouplingUMesh::New\" static method with 2 parameters name and meshDimension !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } @@ -1150,7 +1150,7 @@ void MEDCouplingUMesh::convertToPolyTypes(const int *cellIdsToConvertBg, const i { std::ostringstream oss; oss << "MEDCouplingUMesh::convertToPolyTypes : On rank #" << std::distance(cellIdsToConvertBg,iter) << " value is " << *iter << " which is not"; oss << " in range [0," << nbOfCells << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -1168,7 +1168,7 @@ void MEDCouplingUMesh::convertToPolyTypes(const int *cellIdsToConvertBg, const i { std::ostringstream oss; oss << "MEDCouplingUMesh::convertToPolyTypes : On rank #" << std::distance(cellIdsToConvertBg,iter) << " value is " << *iter << " which is not"; oss << " in range [0," << nbOfCells << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } for(int cellId=0;cellId& nodeIdsInUse) const else { std::ostringstream oss; oss << "MEDCouplingUMesh::computeNodeIdsAlg : In cell #" << i << " presence of node id " << conn[j] << " not in [0," << nbOfNodes << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -1532,7 +1532,7 @@ DataArrayInt *MEDCouplingUMesh::getNodeIdsInUse(int& nbrOfNodesInUse) const else { std::ostringstream oss; oss << "MEDCouplingUMesh::getNodeIdsInUse : In cell #" << i << " presence of node id " << conn[j] << " not in [0," << nbOfNodes << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } nbrOfNodesInUse=(int)std::count(traducer,traducer+nbOfNodes,1); @@ -1974,7 +1974,7 @@ bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int com std::ostringstream oss; oss << "MEDCouplingUMesh::areCellsIncludedIn : only following policies are possible : "; std::copy(possibleCompType,possibleCompType+sizeof(possibleCompType)/sizeof(int),std::ostream_iterator(oss," ")); oss << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } MCAuto o2n=mesh->zipConnectivityTraducer(compType,nbOfCells); arr=o2n->subArray(nbOfCells); @@ -2133,13 +2133,13 @@ void MEDCouplingUMesh::setPartOfMySelf(const int *cellIdsBg, const int *cellIdsE { std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelf : Mismatch of meshdimensions ! this is equal to " << getMeshDimension(); oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int nbOfCellsToModify=(int)std::distance(cellIdsBg,cellIdsEnd); if(nbOfCellsToModify!=otherOnSameCoordsThanThis.getNumberOfCells()) { std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelf : cells ids length (" << nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int nbOfCells=getNumberOfCells(); bool easyAssign=true; @@ -2154,7 +2154,7 @@ void MEDCouplingUMesh::setPartOfMySelf(const int *cellIdsBg, const int *cellIdsE else { std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelf : On pos #" << std::distance(cellIdsBg,it) << " id is equal to " << *it << " which is not in [0," << nbOfCells << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } if(easyAssign) @@ -2182,13 +2182,13 @@ void MEDCouplingUMesh::setPartOfMySelfSlice(int start, int end, int step, const { std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelfSlice : Mismatch of meshdimensions ! this is equal to " << getMeshDimension(); oss << ", whereas other mesh dimension is set equal to " << otherOnSameCoordsThanThis.getMeshDimension() << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int nbOfCellsToModify=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCouplingUMesh::setPartOfMySelfSlice : "); if(nbOfCellsToModify!=otherOnSameCoordsThanThis.getNumberOfCells()) { std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelfSlice : cells ids length (" << nbOfCellsToModify << ") do not match the number of cells of other mesh (" << otherOnSameCoordsThanThis.getNumberOfCells() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int nbOfCells=getNumberOfCells(); bool easyAssign=true; @@ -2204,7 +2204,7 @@ void MEDCouplingUMesh::setPartOfMySelfSlice(int start, int end, int step, const else { std::ostringstream oss; oss << "MEDCouplingUMesh::setPartOfMySelfSlice : On pos #" << i << " id is equal to " << it << " which is not in [0," << nbOfCells << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } if(easyAssign) @@ -2680,7 +2680,7 @@ void MEDCouplingUMesh::renumberNodesInConn(const INTERP_KERNEL::HashMap else { std::ostringstream oss; oss << "MEDCouplingUMesh::renumberNodesInConn(map) : presence in connectivity for cell #" << i << " of node #" << node << " : Not in map !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -2974,7 +2974,7 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(int cellId) co else { std::ostringstream oss; oss << "MEDCouplingUMesh::getTypeOfCell : Requesting type of cell #" << cellId << " but it should be in [0," << _nodal_connec_index->getNbOfElems()-1 << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } @@ -3442,7 +3442,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice(int start, else { std::ostringstream oss; oss << "MEDCouplingUMesh::buildPartOfMySelfKeepCoordsSlice : On pos #" << i << " input cell id =" << work << " should be in [0," << ncell << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } MCAuto newConn=DataArrayInt::New(); newConn->alloc(newConnIPtr[0],1); @@ -3486,7 +3486,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin { free(connIndexRet); std::ostringstream oss; oss << "MEDCouplingUMesh::buildPartOfMySelfKeepCoords : On pos #" << std::distance(begin,work) << " input cell id =" << *work << " should be in [0," << ncell << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } int *connRet=(int *)malloc(connIndexRet[nbOfElemsRet]*sizeof(int)); @@ -4136,7 +4136,7 @@ double MEDCouplingUMesh::distanceToPoint(const double *ptBg, const double *ptEnd throw INTERP_KERNEL::Exception("MEDCouplingUMesh::distanceToPoint : only mesh dimension 2 and 1 are implemented !"); checkFullyDefined(); if((int)std::distance(ptBg,ptEnd)!=spaceDim) - { std::ostringstream oss; oss << "MEDCouplingUMesh::distanceToPoint : input point has to have dimension equal to the space dimension of this (" << spaceDim << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } + { std::ostringstream oss; oss << "MEDCouplingUMesh::distanceToPoint : input point has to have dimension equal to the space dimension of this (" << spaceDim << ") !"; throw INTERP_KERNEL::Exception(oss.str()); } DataArrayInt *ret1=0; MCAuto pts=DataArrayDouble::New(); pts->useArray(ptBg,false,C_DEALLOC,1,spaceDim); MCAuto ret0=distanceToPoints(pts,ret1); @@ -4179,7 +4179,7 @@ DataArrayDouble *MEDCouplingUMesh::distanceToPoints(const DataArrayDouble *pts, if(pts->getNumberOfComponents()!=spaceDim) { std::ostringstream oss; oss << "MEDCouplingUMesh::distanceToPoints : input pts DataArrayDouble has " << pts->getNumberOfComponents() << " components whereas it should be equal to " << spaceDim << " (mesh spaceDimension) !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } checkFullyDefined(); int nbCells=getNumberOfCells(); @@ -5535,7 +5535,7 @@ DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic3D1(DataArrayInt *& if(typ2==INTERP_KERNEL::NORM_ERROR) { std::ostringstream oss; oss << "MEDCouplingUMesh::convertLinearCellsToQuadratic3D1 : On cell #" << i << " the linear cell type does not support advanced quadratization !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } types.insert(typ2); newConn->pushBackSilent(typ2); newConn->pushBackValsSilent(cPtr+icPtr[0]+1,cPtr+icPtr[1]); @@ -6015,7 +6015,7 @@ void MEDCouplingUMesh::subDivide2DMesh(const int *nodeSubdived, const int *nodeI else { std::ostringstream oss; oss << "MEDCouplingUMesh::subDivide2DMesh : On polygon #" << i << " edgeid #" << j << " subedges mismatch : end subedge k!=start subedge k+1 !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } else @@ -6281,7 +6281,7 @@ void MEDCouplingUMesh::orientCorrectlyPolyhedrons() catch(INTERP_KERNEL::Exception& e) { std::ostringstream oss; oss << "Something wrong in polyhedron #" << i << " : " << e.what(); - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -6811,7 +6811,7 @@ DataArrayDouble *MEDCouplingUMesh::getBoundingBoxForBBTreeFast() const if(kk==0) { std::ostringstream oss; oss << "MEDCouplingUMesh::getBoundingBoxForBBTree : cell #" << i << " contains no valid nodeId !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } return ret.retn(); @@ -6959,7 +6959,7 @@ std::vector MEDCouplingUMesh::getDistributionOfTypes() const { std::ostringstream oss; oss << "MEDCouplingUMesh::getDistributionOfTypes : Type " << INTERP_KERNEL::CellModel::GetCellModel(typ).getRepr(); oss << " is not contiguous !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } types.insert(typ); ret[3*i]=typ; @@ -7052,7 +7052,7 @@ DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector< { std::ostringstream oss; oss << "MEDCouplingUMesh::checkTypeConsistencyAndContig : the section " << kk << " points to the profile #" << idInIdsPerType; oss << ", and this profile contains a value " << *k << " should be in [0," << nbOfCellsOfCurType << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -7066,7 +7066,7 @@ DataArrayInt *MEDCouplingUMesh::checkTypeConsistencyAndContig(const std::vector< { std::ostringstream oss; oss << "MEDCouplingUMesh::checkTypeConsistencyAndContig : at section " << kk << " of code it points to the array #" << idInIdsPerType; oss << " should be in [0," << idsPerType.size() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } i=j; @@ -7190,7 +7190,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::emulateMEDMEMBDC(const MEDCouplingUMesh *nM1 ret->getMaxValue(tmp2); ret->decrRef(); std::ostringstream oss; oss << "MEDCouplingUMesh::emulateMEDMEMBDC : input N-1 mesh present a cell not in descending mesh ... Id of cell is " << tmp2 << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } nM1LevMeshIds=ret; // @@ -7325,7 +7325,7 @@ DataArrayInt *MEDCouplingUMesh::getLevArrPerCellTypes(const INTERP_KERNEL::Norma const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[*i]); std::ostringstream oss; oss << "MEDCouplingUMesh::getLevArrPerCellTypes : Cell #" << std::distance(connI,i); oss << " has a type " << cm.getRepr() << " not in input array of type !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } nbPerType=tmpb.retn(); @@ -7473,7 +7473,7 @@ DataArrayInt *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() co { std::ostringstream oss; oss << "MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh : this contains a single geo type (" << cm.getRepr() << ") but "; oss << "this type is dynamic ! Only static geometric type is possible for that type ! call convertNodalConnectivityToDynamicGeoTypeMesh instead !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int nbCells=getNumberOfCells(); int typi=(int)typ; @@ -7490,7 +7490,7 @@ DataArrayInt *MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh() co else { std::ostringstream oss; oss << "MEDCouplingUMesh::convertNodalConnectivityToStaticGeoTypeMesh : there something wrong in cell #" << i << " ! The type of cell is not those expected, or the length of nodal connectivity is not those expected (" << nbNodesPerCell-1 << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } return connOut.retn(); @@ -7671,7 +7671,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::keepSpecifiedCells(INTERP_KERNEL::Normalized { std::ostringstream oss; oss << "MEDCouplingUMesh::keepSpecifiedCells : Request on type " << type << " at place #" << std::distance(idsPerGeoTypeBg,work) << " value " << *work; oss << ". It should be in [0," << szOfType << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } MCAuto idsTokeep=DataArrayInt::New(); idsTokeep->alloc(sz+(int)std::distance(idsPerGeoTypeBg,idsPerGeoTypeEnd),1); int *idsPtr=idsTokeep->getPointer(); @@ -7788,7 +7788,7 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const else { std::ostringstream oss; oss << "MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell : on cell #" << i << " presence of nodeId #" << *conn << " should be in [0," << nbOfNodes << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } int nbOfNodesInCell=nodalI[i+1]-nodalI[i]-1; @@ -7797,7 +7797,7 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const else { std::ostringstream oss; oss << "MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell : on cell #" << i << " presence of cell with no nodes !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } else @@ -7811,7 +7811,7 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const else { std::ostringstream oss; oss << "MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell : on cell polyhedron cell #" << i << " presence of nodeId #" << *it << " should be in [0," << nbOfNodes << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } if(!s.empty()) @@ -7819,7 +7819,7 @@ DataArrayDouble *MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell() const else { std::ostringstream oss; oss << "MEDCouplingUMesh::computeIsoBarycenterOfNodesPerCell : on polyhedron cell #" << i << " there are no nodes !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -7901,14 +7901,14 @@ DataArrayDouble *MEDCouplingUMesh::computePlaneEquationOf3DFaces() const else { std::ostringstream oss; oss << "MEDCouplingUMesh::computePlaneEquationOf3DFaces : invalid 2D cell #" << i << " ! This cell points to an invalid nodeId : " << nodeId << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } else { std::ostringstream oss; oss << "MEDCouplingUMesh::computePlaneEquationOf3DFaces : invalid 2D cell #" << i << " ! Must be constitued by more than 3 nodes !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } INTERP_KERNEL::inverseMatrix(matrix,4,matrix2); retPtr[0]=matrix2[3]; retPtr[1]=matrix2[7]; retPtr[2]=matrix2[11]; retPtr[3]=matrix2[15]; @@ -7988,7 +7988,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshes(std::vector > bb(sz); std::vector< const MEDCouplingUMesh * > aa(sz); @@ -8114,7 +8114,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetCoords(); int meshDim=meshes.front()->getMeshDimension(); @@ -8236,14 +8236,14 @@ void MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords(const std::vector res=DataArrayDouble::Aggregate(coords); @@ -8283,13 +8283,13 @@ void MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords(const std::vector p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]); std::pair p2(p1.second,p1.first); if(std::find(edgesOK.begin(),edgesOK.end(),p1)!=edgesOK.end()) - { std::ostringstream oss; oss << "Face #" << j << " of polyhedron looks bad !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } + { std::ostringstream oss; oss << "Face #" << j << " of polyhedron looks bad !"; throw INTERP_KERNEL::Exception(oss.str()); } if(std::find(edgesFinished.begin(),edgesFinished.end(),p1)!=edgesFinished.end() || std::find(edgesFinished.begin(),edgesFinished.end(),p2)!=edgesFinished.end()) - { std::ostringstream oss; oss << "Face #" << j << " of polyhedron looks bad !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } + { std::ostringstream oss; oss << "Face #" << j << " of polyhedron looks bad !"; throw INTERP_KERNEL::Exception(oss.str()); } std::list< std::pair >::iterator it=std::find(edgesOK.begin(),edgesOK.end(),p2); if(it!=edgesOK.end()) { @@ -10149,7 +10149,7 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo catch(INTERP_KERNEL::Exception& e) { std::ostringstream oss; oss << "Error when computing residual of cell #" << i << " in source/m1 mesh ! Maybe the neighbours of this cell in mesh are not well connected !\n" << "The deep reason is the following : " << e.what(); - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } for(std::map::const_iterator it=mappRev.begin();it!=mappRev.end();it++) @@ -11004,7 +11004,7 @@ void MEDCouplingUMesh::ExtractFromIndexedArrays(const int *idsOfSelectBg, const else { std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " ! Must be in [0," << nbOfGrps << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(lgth>=work[-1]) *work=lgth; @@ -11012,7 +11012,7 @@ void MEDCouplingUMesh::ExtractFromIndexedArrays(const int *idsOfSelectBg, const { std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " and at this pos arrIndxIn[" << *idsIt; oss << "+1]-arrIndxIn[" << *idsIt << "] < 0 ! The input index array is bugged !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } arro->alloc(lgth,1); @@ -11026,7 +11026,7 @@ void MEDCouplingUMesh::ExtractFromIndexedArrays(const int *idsOfSelectBg, const { std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArrays : id located on pos #" << i << " value is " << *idsIt << " arrIndx[" << *idsIt << "] must be >= 0 and arrIndx["; oss << *idsIt << "+1] <= " << maxSizeOfArr << " (the size of arrIn)!"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } arrOut=arro.retn(); @@ -11078,7 +11078,7 @@ void MEDCouplingUMesh::ExtractFromIndexedArraysSlice(int idsOfSelectStart, int i else { std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " ! Must be in [0," << nbOfGrps << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(lgth>=work[-1]) *work=lgth; @@ -11086,7 +11086,7 @@ void MEDCouplingUMesh::ExtractFromIndexedArraysSlice(int idsOfSelectStart, int i { std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " and at this pos arrIndxIn[" << idsIt; oss << "+1]-arrIndxIn[" << idsIt << "] < 0 ! The input index array is bugged !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } arro->alloc(lgth,1); @@ -11100,7 +11100,7 @@ void MEDCouplingUMesh::ExtractFromIndexedArraysSlice(int idsOfSelectStart, int i { std::ostringstream oss; oss << "MEDCouplingUMesh::ExtractFromIndexedArraysSlice : id located on pos #" << i << " value is " << idsIt << " arrIndx[" << idsIt << "] must be >= 0 and arrIndx["; oss << idsIt << "+1] <= " << maxSizeOfArr << " (the size of arrIn)!"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } arrOut=arro.retn(); @@ -11147,7 +11147,7 @@ void MEDCouplingUMesh::SetPartOfIndexedArrays(const int *idsOfSelectBg, const in else { std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArrays : On pos #" << std::distance(idsOfSelectBg,it) << " value is " << *it << " not in [0," << nbOfTuples << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } srcArrIndexPtr=srcArrIndex->getConstPointer(); @@ -11207,13 +11207,13 @@ void MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx(const int *idsOfSelectBg, c else { std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : On pos #" << std::distance(idsOfSelectBg,it) << " id (idsOfSelectBg[" << std::distance(idsOfSelectBg,it)<< "]) is " << *it << " arrIndxIn[id+1]-arrIndxIn[id]!=srcArrIndex[pos+1]-srcArrIndex[pos] !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } else { std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArraysSameIdx : On pos #" << std::distance(idsOfSelectBg,it) << " value is " << *it << " not in [0," << nbOfTuples << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -11282,7 +11282,7 @@ DataArrayInt *MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg(std::vecto if(*seedElt>=0 && *seedEltgetConstPointer(); const int *arrIndxPtr=arrIndxIn->getConstPointer(); @@ -11350,7 +11350,7 @@ void MEDCouplingUMesh::SetPartOfIndexedArraysSlice(int start, int end, int step, else { std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArraysSlice : On pos #" << i << " value is " << it << " not in [0," << nbOfTuples << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } srcArrIndexPtr=srcArrIndex->getConstPointer(); @@ -11413,13 +11413,13 @@ void MEDCouplingUMesh::SetPartOfIndexedArraysSameIdxSlice(int start, int end, in else { std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArraysSameIdxSlice : On pos #" << i << " id (idsOfSelectBg[" << i << "]) is " << it << " arrIndxIn[id+1]-arrIndxIn[id]!=srcArrIndex[pos+1]-srcArrIndex[pos] !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } else { std::ostringstream oss; oss << "MEDCouplingUMesh::SetPartOfIndexedArraysSameIdxSlice : On pos #" << i << " value is " << it << " not in [0," << nbOfTuples << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index b770def51..648ef3259 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -301,7 +301,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile : existing profile with empty name !"); if(_type!=ON_GAUSS_PT) { - locIds->setName(oss.str().c_str()); + locIds->setName(oss.str()); glob.appendProfile(locIds); _profile=oss.str(); } @@ -367,7 +367,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& if(locIds) { MCAuto da5=locIds->selectByTupleId(da3->begin(),da3->end()); - da5->setName(oss.str().c_str()); + da5->setName(oss.str()); glob.appendProfile(da5); _profile=oss.str(); } @@ -375,7 +375,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::assignFieldProfile(bool isPflAlone, int& { if(!da3->isIota(nbOfEltsInWholeMesh)) { - da3->setName(oss.str().c_str()); + da3->setName(oss.str()); glob.appendProfile(da3); _profile=oss.str(); } @@ -469,7 +469,7 @@ void MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile(med_idt fid, const if(_end-_start!=nbValsInFile*nbi) { std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile : The number of tuples to read is " << nbValsInFile << "*" << nbi << " (nb integration points) ! But in data structure it values " << _end-_start << " is expected !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } MEDFILESAFECALLERRD0(MEDfieldValueWithProfileRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,MED_COMPACT_PFLMODE,_profile.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,startFeedingPtr)); } @@ -585,12 +585,12 @@ void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, const MEDFileF if(_start<0 || _start>=arr->getNumberOfTuples()) { std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : Invalid start ("<< _start << ") regarding admissible range of allocated array [0," << arr->getNumberOfTuples() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(_end<0 || _end>arr->getNumberOfTuples()) { std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : Invalid start ("<< _start << ") regarding admissible range of allocated array [0," << arr->getNumberOfTuples() << "] !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int nbOfCompo(arr->getNumberOfComponents()); DataArrayDouble *arrD(dynamic_cast(arr)); @@ -822,7 +822,7 @@ int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std: { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getGeoType()); oss << "MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode : not found geometric type " << cm.getRepr() << " in the referenced mesh of field !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int *work=ptToFill; if(_profile.empty()) @@ -832,7 +832,7 @@ int MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode(int offset, const std: const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getGeoType()); oss << "MEDFileFieldPerMeshPerTypePerDisc::fillEltIdsFromCode : for geometric type " << cm.getRepr() << " number of elt ids in mesh is equal to " << _nval; oss << " whereas mesh has " << codeOfMesh[3*found+1] << " for this geometric type !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } for(int ii=codeOfMesh[3*found+2];iigetNumberOfTuples() << " whereas the number of ids is set to " << _nval << " for this geometric type !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int offset2=codeOfMesh[3*found+2]; for(const int *pflId=pfl->begin();pflId!=pfl->end();pflId++) @@ -1480,7 +1480,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerType::getLeafGivenLocId { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type); std::ostringstream oss; oss << "MEDFileFieldPerMeshPerType::getLeafGivenLocId : no localizations for geotype \"" << cm.getRepr() << "\" !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(locId>=0 && locId<(int)_field_pm_pt_pd.size()) return _field_pm_pt_pd[locId]; @@ -1497,7 +1497,7 @@ const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMeshPerType::getLeafGive { const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type); std::ostringstream oss; oss << "MEDFileFieldPerMeshPerType::getLeafGivenLocId : no localizations for geotype \"" << cm.getRepr() << "\" !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(locId>=0 && locId<(int)_field_pm_pt_pd.size()) return _field_pm_pt_pd[locId]; @@ -2207,7 +2207,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t if(code.empty()) { std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevel : " << "The field \"" << nasc.getName() << "\" exists but not with such spatial discretization or such dimension specified !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } // std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); @@ -2234,7 +2234,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::getFieldOnMeshAtLevel(TypeOfField t { std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevel : There is a problem there is " << nb << " nodes in field whereas there is " << mesh->getNumberOfNodes(); oss << " nodes in mesh !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } return finishField(type,glob,dads,locs,mesh,isPfl,arrOut,nasc); } @@ -2260,7 +2260,7 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c if(code.empty()) { std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl : " << "The field \"" << nasc.getName() << "\" exists but not with such spatial discretization or such dimension specified !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } std::vector< MCAuto > notNullPflsPerGeoType2(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); std::vector< const DataArrayInt *> notNullPflsPerGeoType3(notNullPflsPerGeoType.begin(),notNullPflsPerGeoType.end()); @@ -2280,7 +2280,7 @@ DataArray *MEDFileFieldPerMesh::getFieldOnMeshAtLevelWithPfl(TypeOfField type, c { std::ostringstream oss; oss << "MEDFileFieldPerMesh::getFieldOnMeshAtLevel : There is a problem there is " << nb << " nodes in field whereas there is " << mesh->getNumberOfNodes(); oss << " nodes in mesh !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } return finishField4(dads,code[2]==-1?0:notNullPflsPerGeoType3[0],mesh->getNumberOfNodes(),pfl); @@ -2320,7 +2320,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType()); oss << "\"" << cm2.getRepr() << "\", "; } - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAndLocId(INTERP_KERNEL::NormalizedCellType typ, int locId) const @@ -2338,7 +2338,7 @@ const MEDFileFieldPerMeshPerTypePerDisc *MEDFileFieldPerMesh::getLeafGivenTypeAn const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel((*it)->getGeoType()); oss << "\"" << cm2.getRepr() << "\", "; } - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type) @@ -2474,7 +2474,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField oss << " - use an another meshDim compatible with the field on nodes (MED file does not have such information)" << std::endl; oss << " - use an another a meshDimRelToMax equal to 1 -> it will return a mesh with artificial cell POINT1 containing the profile !" << std::endl; oss << " - if definitely the node profile has no link with mesh connectivity use MEDFileField1TS::getFieldWithProfile or MEDFileFieldMultiTS::getFieldWithProfile methods instead !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } return 0; } @@ -2695,7 +2695,7 @@ void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) if(!(*it)->isEqual(*_pfls[id])) { std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Profile \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -2713,7 +2713,7 @@ void MEDFileFieldGlobs::appendGlobs(const MEDFileFieldGlobs& other, double eps) if(!(*it)->isEqual(*_locs[id],eps)) { std::ostringstream oss; oss << "MEDFileFieldGlobs::appendGlobs : Localization \"" << (*it)->getName() << "\" already exists and is different from those expecting to be append !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -2991,7 +2991,7 @@ int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const std::ostringstream oss; oss << "MEDFileFieldGlobs::getLocalisationId : no such localisation name : \"" << loc << "\" Possible localizations are : "; for(it=_locs.begin();it!=_locs.end();it++) oss << "\"" << (*it)->getName() << "\", "; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } return std::distance(_locs.begin(),it); } @@ -3008,7 +3008,7 @@ const DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) co std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : "; for(it=_pfls.begin();it!=_pfls.end();it++) oss << "\"" << (*it)->getName() << "\", "; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } return *it; } @@ -3044,7 +3044,7 @@ DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) std::ostringstream oss; oss << "MEDFileFieldGlobs::getProfile: no such profile name : \"" << pflNameCpp << "\" Possible profiles are : "; for(it=_pfls.begin();it!=_pfls.end();it++) oss << "\"" << (*it)->getName() << "\", "; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } return *it; } @@ -3168,7 +3168,7 @@ void MEDFileFieldGlobs::appendProfile(DataArrayInt *pfl) if(!pfl->isEqual(*(*it))) { std::ostringstream oss; oss << "MEDFileFieldGlobs::appendProfile : profile \"" << name << "\" already exists and is different from existing !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } pfl->incrRef(); @@ -3187,7 +3187,7 @@ void MEDFileFieldGlobs::appendLoc(const std::string& locName, INTERP_KERNEL::Nor if(!(*it)->isEqual(*obj,1e-12)) { std::ostringstream oss; oss << "MEDFileFieldGlobs::appendLoc : localization \"" << name << "\" already exists and is different from existing !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } _locs.push_back(obj); @@ -4283,7 +4283,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::getMeshIdFromMeshName(const std::string& m oss << "Possible meshes are : "; for(std::vector::const_iterator it2=msg.begin();it2!=msg.end();it2++) oss << "\"" << (*it2) << "\" "; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMesh *mesh) @@ -4626,7 +4626,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDou if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples()) { std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : The array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } // end of check int start=copyTinyInfoFrom(field,arrOfVals); @@ -4645,7 +4645,7 @@ void MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile(const MEDCouplingFieldDou if(nbOfTuplesExp!=arrOfVals->getNumberOfTuples()) { std::ostringstream oss; oss << "MEDFileAnyTypeField1TSWithoutSDA::setFieldProfile : For node field, the array is expected to have " << nbOfTuplesExp << " tuples ! It has " << arrOfVals->getNumberOfTuples() << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int start=copyTinyInfoFrom(field,arrOfVals); int pos=addNewEntryIfNecessary(m); @@ -4931,7 +4931,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( { std::ostringstream oss; oss << "MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : Request of simple renumbering but it seems that underlying mesh \"" << mesh->getName() << "\" of requested field "; oss << "\"" << getName() << "\" has partial renumbering (some geotype has no renumber) !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } MEDCouplingFieldDiscretization *disc=ret->getDiscretization(); if(!disc) throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel : internal error, no discretization on field !"); @@ -4954,7 +4954,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel( { std::ostringstream oss; oss << "MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : Request of simple renumbering but it seems that underlying mesh \"" << mesh->getName() << "\" of requested field "; oss << "\"" << nasc.getName() << "\" not defined on all nodes !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } MCAuto nodeRenumSafe=nodeRenum->checkAndPreparePermutation(); if(!dynamic_cast((DataArray *)arrOut)) @@ -5491,7 +5491,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i default: { std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32] !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } ret->setDtUnit(dtunit.c_str()); @@ -5545,7 +5545,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i default: { std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName,fieldName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } ret->setDtUnit(dtunit.c_str()); @@ -5554,7 +5554,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i if(nbSteps<1) { std::ostringstream oss; oss << "MEDFileField1TS(fileName,fieldName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but there is no time steps on it !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } // med_int numdt,numit; @@ -5656,7 +5656,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i default: { std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::BuildContentFrom(fileName,fieldName,iteration,order) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } ret->setDtUnit(dtunit.c_str()); @@ -5682,7 +5682,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i std::ostringstream oss; oss << "No such iteration (" << iteration << "," << order << ") in existing field '" << fieldName << "' in file '" << fileName << "' ! Available iterations are : "; for(std::vector< std::pair >::const_iterator iter=dtits.begin();iter!=dtits.end();iter++) oss << "(" << (*iter).first << "," << (*iter).second << "), "; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(loadAll) ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret),ms,0); @@ -5732,7 +5732,7 @@ int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, const std::string& fileNam if(fieldIdCFormat>=nbFields) { std::ostringstream oss; oss << "MEDFileAnyTypeField1TS::LocateField2(fileName) : in file \'" << fileName << "\' number of fields is " << nbFields << " ! Trying to request for id " << fieldIdCFormat << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } int ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1)); @@ -5778,7 +5778,7 @@ int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fileName std::ostringstream oss; oss << "No such field '" << fieldName << "' in file '" << fileName << "' ! Available fields are : "; for(std::vector::const_iterator it=fns.begin();it!=fns.end();it++) oss << "\"" << *it << "\" "; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } return nbOfStep2; } @@ -5816,7 +5816,7 @@ void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const std::string& mName, INTE else { std::ostringstream oss; oss << "MEDFileField1TS::setProfileNameOnLeaf : Profile \"" << newPflName << "\" already exists or referenced more than one !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } @@ -5854,7 +5854,7 @@ void MEDFileAnyTypeField1TS::setLocNameOnLeaf(const std::string& mName, INTERP_K else { std::ostringstream oss; oss << "MEDFileField1TS::setLocNameOnLeaf : Localization \"" << newLocName << "\" already exists or referenced more than one !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } @@ -6877,26 +6877,6 @@ MEDFileField1TS *MEDFileIntField1TS::convertToDouble(bool isDeepCpyGlobs) const return ret.retn(); } -/*! - * Adds a MEDCouplingFieldDouble to \a this. The underlying mesh of the given field is - * checked if its elements are sorted suitable for writing to MED file ("STB" stands for - * "Sort By Type"), if not, an exception is thrown. - * For more info, see \ref AdvMEDLoaderAPIFieldRW - * \param [in] field - the field to add to \a this. The field double values are ignored. - * \param [in] arrOfVals - the values of the field \a field used. - * \throw If the name of \a field is empty. - * \throw If the data array of \a field is not set. - * \throw If the data array is already allocated but has different number of components - * than \a field. - * \throw If the underlying mesh of \a field has no name. - * \throw If elements in the mesh are not in the order suitable for writing to the MED file. - */ -void MEDFileIntField1TS::setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) -{ - setFileName(""); - contentNotNull()->setFieldNoProfileSBT(field,arrOfVals,*this,*contentNotNull()); -} - /*! * Adds a MEDCouplingFieldInt to \a this. The underlying mesh of the given field is * checked if its elements are sorted suitable for writing to MED file ("STB" stands for @@ -6917,35 +6897,6 @@ void MEDFileIntField1TS::setFieldNoProfileSBT(const MEDCouplingFieldInt *field) contentNotNull()->setFieldNoProfileSBT(field2,field->getArray(),*this,*contentNotNull()); } -/*! - * Adds a MEDCouplingFieldDouble to \a this. As described in \ref MEDLoaderMainC a field in MED file sense - * can be an aggregation of several MEDCouplingFieldDouble instances. - * The mesh support of input parameter \a field is ignored here, it can be NULL. - * The support of field \a field is expected to be those computed with the input parameter \a mesh, \a meshDimRelToMax, - * and \a profile. - * - * This method will check that the field based on the computed support is coherent. If not an exception will be thrown. - * A new profile is added only if no equal profile is missing. - * For more info, see \ref AdvMEDLoaderAPIFieldRW - * \param [in] field - the field to add to \a this. The field double values and mesh support are ignored. - * \param [in] arrOfVals - the values of the field \a field used. - * \param [in] mesh - the supporting mesh of \a field. - * \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on (useless if field spatial discretization is ON_NODES). - * \param [in] profile - ids of mesh entities on which corresponding field values lie. - * \throw If either \a field or \a mesh or \a profile has an empty name. - * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh. - * \throw If the data array of \a field is not set. - * \throw If the data array of \a this is already allocated but has different number of - * components than \a field. - * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. - * \sa setFieldNoProfileSBT() - */ -void MEDFileIntField1TS::setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) -{ - setFileName(""); - contentNotNull()->setFieldProfile(field,arrOfVals,mesh,meshDimRelToMax,profile,*this,*contentNotNull()); -} - /*! * Adds a MEDCouplingFieldInt to \a this. As described in \ref MEDLoaderMainC a field in MED file sense * can be an aggregation of several MEDCouplingFieldDouble instances. @@ -7290,7 +7241,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds : At pos #" << std::distance(startIds,id) << " value is " << *id; oss << " ! Should be in [0," << sz << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } if(ret->getNumberOfTS()>0) @@ -7328,7 +7279,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::buil { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::buildFromTimeStepIds : At pos #" << i << " value is " << j; oss << " ! Should be in [0," << sz << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } if(ret->getNumberOfTS()>0) @@ -7405,7 +7356,7 @@ int MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepPos(int iteration, int orde std::vector< std::pair > vp=getIterations(); for(std::vector< std::pair >::const_iterator it2=vp.begin();it2!=vp.end();it2++) oss << "(" << (*it2).first << "," << (*it2).second << ") "; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } const MEDFileAnyTypeField1TSWithoutSDA& MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepEntry(int iteration, int order) const @@ -7515,7 +7466,7 @@ std::vector< std::pair > MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeS else { std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getTimeSteps : At rank #" << i << " time step is not defined. Invoke eraseEmptyTS method !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } return ret; @@ -7548,7 +7499,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope() { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::synchronizeNameScope : Mismatch in the number of components of parts ! Should be " << nbOfCompo; oss << " ! but the field at iteration=" << cur->getIteration() << " order=" << cur->getOrder() << " has " << (cur->getInfo()).size() << " components !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } cur->copyNameScope(*this); } @@ -7674,7 +7625,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::eraseTimeStepIds(const int *startIds, else { std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::eraseTimeStepIds : At pos #" << ii << " request for id=" << *id << " not in [0," << maxId << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } for(int iii=0;iii > MEDFileAnyTypeFieldMultiTSWithoutSDA::getIterations() const @@ -7792,14 +7743,14 @@ const MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::ge if(pos<0 || pos>=(int)_time_steps.size()) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } const MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos]; if(item==0) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !"; oss << "\nTry to use following method eraseEmptyTS !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } return item; } @@ -7809,14 +7760,14 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeS if(pos<0 || pos>=(int)_time_steps.size()) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << " whereas should be in [0," << _time_steps.size() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } MEDFileAnyTypeField1TSWithoutSDA *item=_time_steps[pos]; if(item==0) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::getTimeStepAtPos2 : request for pos #" << pos << ", this pos id exists but the underlying Field1TS is null !"; oss << "\nTry to use following method eraseEmptyTS !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } return item; } @@ -7934,7 +7885,7 @@ std::vector< MCAuto > MEDFileAnyTypeFieldM if(ret1.size()!=sz) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitComponents : At rank #" << i << " number of components is " << ret1.size() << " whereas it should be for all time steps " << sz << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } ts[i]=ret1; } @@ -7958,7 +7909,7 @@ std::vector< MCAuto > MEDFileAnyTypeFieldM if(!timeStep) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : time step #" << i << " is null !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } items[i]=timeStep->splitDiscretizations(); } @@ -8009,7 +7960,7 @@ std::vector< MCAuto > MEDFileAnyTypeFieldM if(!timeStep) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitMultiDiscrPerGeoTypes : time step #" << i << " is null !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } items[i]=timeStep->splitMultiDiscrPerGeoTypes(); if(szOut==std::numeric_limits::max()) @@ -8049,7 +8000,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo(const MEDCou { std::ostringstream oss; oss << MSG << "name ! should be \"" << _name; oss << "\" and it is set in input field to \"" << field->getName() << "\" !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(!arr) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::checkCoherencyOfTinyInfo : no array set !"); @@ -8063,7 +8014,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatComponentsMatch(const std::v { std::ostringstream oss; oss << MSG << "mismatch of number of components between this (" << getInfo().size() << ") and "; oss << " number of components of element to append (" << compos.size() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(_infos!=compos) { @@ -8072,7 +8023,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatComponentsMatch(const std::v oss << " But compo in input fields are : "; std::copy(compos.begin(),compos.end(),std::ostream_iterator(oss,", ")); oss << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } @@ -8088,7 +8039,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis() con { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::checkThatNbOfCompoOfTSMatchThis : At pos #" << j << " the number of components is equal to "; oss << elt->getInfo().size() << " whereas it is expected to be equal to " << sz << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -8125,7 +8076,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAuto=sz) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element at place #" << i << " should be in [0," << sz << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } const MEDFileAnyTypeField1TSWithoutSDA *tsPtr(ts); if(tsPtr) @@ -8133,7 +8084,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MCAutogetNumberOfComponents()!=(int)_infos.size()) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration : trying to set element with " << tsPtr->getNumberOfComponents() << " components ! Should be " << _infos.size() << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } _time_steps[i]=ts; @@ -8275,7 +8226,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr default: { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fileName,fieldName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } ret->setDtUnit(dtunit.c_str()); @@ -8305,7 +8256,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr default: { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fileName) : file \'" << fileName << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32] !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } ret->setDtUnit(dtunit.c_str()); @@ -9072,12 +9023,12 @@ int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiT if(f0->getMeshName()!=mesh->getName()) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : first field points to mesh \""<< f0->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(f1->getMeshName()!=mesh->getName()) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : second field points to mesh \""<< f1->getMeshName() << "\" and input mesh to compare has name \"" << mesh->getName() << "\" !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } int nts=f0->getNumberOfTS(); if(nts!=f1->getNumberOfTS()) @@ -9101,17 +9052,17 @@ int MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiT if(f0cur->getMeshIteration()!=mesh->getIteration() || f0cur->getMeshOrder()!=mesh->getOrder()) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : first field points to mesh time step (" << f0cur->getMeshIteration() << ","<< f0cur->getMeshOrder() << ") whereas input mesh points to time step (" << mesh->getIteration() << "," << mesh->getOrder() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(f1cur->getMeshIteration()!=mesh->getIteration() || f1cur->getMeshOrder()!=mesh->getOrder()) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : second field points to mesh time step (" << f1cur->getMeshIteration() << ","<< f1cur->getMeshOrder() << ") whereas input mesh points to time step (" << mesh->getIteration() << "," << mesh->getOrder() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } if(f0cur->getIteration()!=f1cur->getIteration() || f0cur->getOrder()!=f1cur->getOrder()) { std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::CheckSupportAcrossTime : all the time steps must be the same ! it is not the case (" << f0cur->getIteration() << "," << f0cur->getOrder() << ")!=(" << f1cur->getIteration() << "," << f1cur->getOrder() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } return nts; @@ -9267,7 +9218,7 @@ MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const if(!item) { std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : field at pos #" << pos << " is null !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } const MEDFileField1TSWithoutSDA *itemC=dynamic_cast(item); if(itemC) @@ -9277,7 +9228,7 @@ MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const return ret.retn(); } std::ostringstream oss; oss << "MEDFileFieldMultiTS::getTimeStepAtPos : type of field at pos #" << pos << " is not FLOAT64 !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } /*! @@ -9747,6 +9698,9 @@ void MEDFileIntFieldMultiTS::checkCoherencyOfType(const MEDFileAnyTypeField1TS * MEDCouplingFieldInt *MEDFileIntFieldMultiTS::field(int iteration, int order, const MEDFileMesh *mesh) const { const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order)); + const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast(&myF1TS)); + if(!myF1TSC) + throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::field : mismatch of type of field expecting INT32 !"); MCAuto arrOut; MCAuto ret(myF1TS.fieldOnMesh(this,mesh,arrOut,*contentNotNullBase())); MCAuto ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arrOut)); @@ -9754,14 +9708,13 @@ MEDCouplingFieldInt *MEDFileIntFieldMultiTS::field(int iteration, int order, con } /*! - * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on + * Returns a new MEDCouplingFieldInt of a given type, of a given time step, lying on * mesh entities of a given dimension of the first mesh in MED file. * For more info, see \ref AdvMEDLoaderAPIFieldRW * \param [in] type - a spatial discretization of interest. * \param [in] iteration - the iteration number of a required time step. * \param [in] order - the iteration order number of required time step. * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. - * \param [out] arrOut - the DataArrayInt containing values of field. * \param [in] renumPol - specifies how to permute values of the result field according to * the optional numbers of cells and nodes, if any. The valid values are * - 0 - do not permute. @@ -9769,14 +9722,14 @@ MEDCouplingFieldInt *MEDFileIntFieldMultiTS::field(int iteration, int order, con * - 2 - permute nodes. * - 3 - permute cells and nodes. * - * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The * caller is to delete this field using decrRef() as it is no more needed. * \throw If the MED file is not readable. * \throw If there is no mesh in the MED file. * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh. * \throw If no field values of the required parameters are available. */ -MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const +MEDCouplingFieldInt *MEDFileIntFieldMultiTS::getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol) const { const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order)); const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast(&myF1TS)); @@ -9784,18 +9737,17 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevel(TypeOfField type throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting INT32 !"); MCAuto arr; MCAuto ret(myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arr,*contentNotNullBase())); - arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); - return ret.retn(); + MCAuto ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arr)); + return ret2.retn(); } /*! - * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on + * Returns a new MEDCouplingFieldInt of a given type, of a given time step, lying on * the top level cells of the first mesh in MED file. * For more info, see \ref AdvMEDLoaderAPIFieldRW * \param [in] type - a spatial discretization of interest. * \param [in] iteration - the iteration number of a required time step. * \param [in] order - the iteration order number of required time step. - * \param [out] arrOut - the DataArrayInt containing values of field. * \param [in] renumPol - specifies how to permute values of the result field according to * the optional numbers of cells and nodes, if any. The valid values are * - 0 - do not permute. @@ -9803,32 +9755,31 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevel(TypeOfField type * - 2 - permute nodes. * - 3 - permute cells and nodes. * - * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The * caller is to delete this field using decrRef() as it is no more needed. * \throw If the MED file is not readable. * \throw If there is no mesh in the MED file. * \throw If no field values of the required parameters are available. */ -MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtTopLevel(TypeOfField type, int iteration, int order, DataArrayInt* &arrOut, int renumPol) const +MEDCouplingFieldInt *MEDFileIntFieldMultiTS::getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol) const { - const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order); - const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); + const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order)); + const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast(&myF1TS)); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtTopLevel : mismatch of type of field ! INT32 expected !"); MCAuto arr; - MCAuto ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNullBase()); - arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); - return ret.retn(); + MCAuto ret(myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNullBase())); + MCAuto ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arr)); + return ret2.retn(); } /*! - * Returns a new MEDCouplingFieldDouble of a given type, of a given time step, lying on + * Returns a new MEDCouplingFieldInt of a given type, of a given time step, lying on * a given support. * For more info, see \ref AdvMEDLoaderAPIFieldRW * \param [in] type - a spatial discretization of interest. * \param [in] iteration - the iteration number of a required time step. * \param [in] order - the iteration order number of required time step. - * \param [out] arrOut - the DataArrayInt containing values of field. * \param [in] meshDimRelToMax - a relative dimension of the supporting mesh entities. * \param [in] mesh - the supporting mesh. * \param [in] renumPol - specifies how to permute values of the result field according to @@ -9838,26 +9789,26 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtTopLevel(TypeOfField t * - 2 - permute nodes. * - 3 - permute cells and nodes. * - * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The * caller is to delete this field using decrRef() as it is no more needed. * \throw If there are no mesh entities of \a meshDimRelToMax dimension in the mesh. * \throw If no field of \a this is lying on \a mesh. * \throw If no field values of the required parameters are available. */ -MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol) const +MEDCouplingFieldInt *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol) const { - const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order); - const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); + const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order)); + const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast(&myF1TS)); if(!myF1TSC) - throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !"); + throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !"); MCAuto arr; - MCAuto ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNullBase()); - arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); - return ret.retn(); + MCAuto ret(myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arr,*contentNotNullBase())); + MCAuto ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arr)); + return ret2.retn(); } /*! - * Returns a new MEDCouplingFieldDouble of given type, of a given time step, lying on a + * Returns a new MEDCouplingFieldInt of given type, of a given time step, lying on a * given support. * For more info, see \ref AdvMEDLoaderAPIFieldRW * \param [in] type - a spatial discretization of the new field. @@ -9872,21 +9823,21 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfFiel * - 2 - permute nodes. * - 3 - permute cells and nodes. * - * \return MEDCouplingFieldDouble * - a new instance of MEDCouplingFieldDouble. The + * \return MEDCouplingFieldInt * - a new instance of MEDCouplingFieldDouble. The * caller is to delete this field using decrRef() as it is no more needed. * \throw If no field of \a this is lying on \a mesh. * \throw If no field values of the required parameters are available. */ -MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol) const +MEDCouplingFieldInt *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol) const { - const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order); - const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); + const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order)); + const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast(&myF1TS)); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldIntMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !"); MCAuto arr; - MCAuto ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNullBase()); - arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); - return ret.retn(); + MCAuto ret(myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arr,*contentNotNullBase())); + MCAuto ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arr)); + return ret2.retn(); } /*! @@ -9894,16 +9845,16 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfFiel * This method is called 'old' because the user should give the mesh name he wants to use for it's field. * This method is useful for MED2 file format when field on different mesh was autorized. */ -MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const +MEDCouplingFieldInt *MEDFileIntFieldMultiTS::getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol) const { - const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order); - const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast(&myF1TS); + const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order)); + const MEDFileIntField1TSWithoutSDA *myF1TSC(dynamic_cast(&myF1TS)); if(!myF1TSC) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field ! INT32 expected !"); MCAuto arr; - MCAuto ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNullBase()); - arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr); - return ret.retn(); + MCAuto ret(myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arr,*contentNotNullBase())); + MCAuto ret2(MEDFileIntField1TS::SetDataArrayDoubleInIntField(ret,arr)); + return ret2.retn(); } /*! @@ -9949,7 +9900,7 @@ MEDFileAnyTypeField1TS *MEDFileIntFieldMultiTS::getTimeStepAtPos(int pos) const if(!item) { std::ostringstream oss; oss << "MEDFileIntFieldMultiTS::getTimeStepAtPos : field at pos #" << pos << " is null !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } const MEDFileIntField1TSWithoutSDA *itemC=dynamic_cast(item); if(itemC) @@ -9959,7 +9910,7 @@ MEDFileAnyTypeField1TS *MEDFileIntFieldMultiTS::getTimeStepAtPos(int pos) const return ret.retn(); } std::ostringstream oss; oss << "MEDFileIntFieldMultiTS::getTimeStepAtPos : type of field at pos #" << pos << " is not INT32 !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } /*! @@ -9980,23 +9931,6 @@ void MEDFileIntFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldInt * contentNotNull()->appendFieldNoProfileSBT(field2,field->getArray(),*this); } -/*! - * Adds a MEDCouplingFieldDouble to \a this as another time step. The underlying mesh of - * the given field is checked if its elements are sorted suitable for writing to MED file - * ("STB" stands for "Sort By Type"), if not, an exception is thrown. - * For more info, see \ref AdvMEDLoaderAPIFieldRW - * \param [in] field - the field to add to \a this. - * \throw If the name of \a field is empty. - * \throw If the data array of \a field is not set. - * \throw If existing time steps have different name or number of components than \a field. - * \throw If the underlying mesh of \a field has no name. - * \throw If elements in the mesh are not in the order suitable for writing to the MED file. - */ -void MEDFileIntFieldMultiTS::appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) -{ - contentNotNull()->appendFieldNoProfileSBT(field,arrOfVals,*this); -} - /*! * Adds a MEDCouplingFieldDouble to \a this as another time step. * The mesh support of input parameter \a field is ignored here, it can be NULL. @@ -10025,33 +9959,6 @@ void MEDFileIntFieldMultiTS::appendFieldProfile(const MEDCouplingFieldInt *field contentNotNull()->appendFieldProfile(field2,field->getArray(),mesh,meshDimRelToMax,profile,*this); } -/*! - * Adds a MEDCouplingFieldDouble to \a this as another time step. - * The mesh support of input parameter \a field is ignored here, it can be NULL. - * The support of field \a field is expected to be those computed with the input parameter \a mesh, \a meshDimRelToMax, - * and \a profile. - * - * This method will check that the field based on the computed support is coherent. If not an exception will be thrown. - * A new profile is added only if no equal profile is missing. - * For more info, see \ref AdvMEDLoaderAPIFieldRW - * \param [in] field - the field to add to \a this. The field double values and mesh support are ignored. - * \param [in] arrOfVals - the values of the field \a field used. - * \param [in] mesh - the supporting mesh of \a field. - * \param [in] meshDimRelToMax - a relative dimension of mesh entities \a field lies on (useless if field spatial discretization is ON_NODES). - * \param [in] profile - ids of mesh entities on which corresponding field values lie. - * \throw If either \a field or \a mesh or \a profile has an empty name. - * \throw If there are no mesh entities of \a meshDimRelToMax dimension in \a mesh. - * \throw If the data array of \a field is not set. - * \throw If the data array of \a this is already allocated but has different number of - * components than \a field. - * \throw If elements in \a mesh are not in the order suitable for writing to the MED file. - * \sa setFieldNoProfileSBT() - */ -void MEDFileIntFieldMultiTS::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) -{ - contentNotNull()->appendFieldProfile(field,arrOfVals,mesh,meshDimRelToMax,profile,*this); -} - const MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTS::contentNotNull() const { const MEDFileAnyTypeFieldMultiTSWithoutSDA *pt(_content); @@ -10217,7 +10124,7 @@ std::vector MEDFileFields::getFieldsNames() const else { std::ostringstream oss; oss << "MEDFileFields::getFieldsNames : At rank #" << i << " field is not defined !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } return ret; @@ -10312,7 +10219,7 @@ try:MEDFileFieldGlobsReal(fileName) default: { std::ostringstream oss; oss << "constructor MEDFileFields(fileName) : file \'" << fileName << "\' at pos #" << i << " field has name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32] !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } } } @@ -10333,7 +10240,7 @@ void MEDFileFields::writeLL(med_idt fid) const if(!elt) { std::ostringstream oss; oss << "MEDFileFields::write : at rank #" << i << "/" << _fields.size() << " field is empty !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } elt->writeLL(fid,*this); } @@ -10527,7 +10434,7 @@ void MEDFileFields::destroyFieldsAtPos(const int *startIds, const int *endIds) if(*i<0 || *i>=(int)_fields.size()) { std::ostringstream oss; oss << "MEDFileFields::destroyFieldsAtPos : Invalid given id in input (" << *i << ") should be in [0," << _fields.size() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } b[*i]=false; } @@ -10550,7 +10457,7 @@ void MEDFileFields::destroyFieldsAtPos2(int bg, int end, int step) if(k<0 || k>=(int)_fields.size()) { std::ostringstream oss; oss << "MEDFileFields::destroyFieldsAtPos2 : Invalid given id in input (" << k << ") should be in [0," << _fields.size() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } b[k]=false; } @@ -10615,7 +10522,7 @@ MEDFileFields *MEDFileFields::extractPart(const std::map fmtsOut(fmts->extractPart(extractDef,mm)); fsOut->pushField(fmtsOut); @@ -10628,7 +10535,7 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const if(i<0 || i>=(int)_fields.size()) { std::ostringstream oss; oss << "MEDFileFields::getFieldAtPos : Invalid given id in input (" << i << ") should be in [0," << _fields.size() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } const MEDFileAnyTypeFieldMultiTSWithoutSDA *fmts=_fields[i]; if(!fmts) @@ -10643,7 +10550,7 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldAtPos(int i) const else { std::ostringstream oss; oss << "MEDFileFields::getFieldAtPos : At pos #" << i << " field is neither double (FLOAT64) nor integer (INT32) !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } ret->shallowCpyGlobs(*this); return ret.retn(); @@ -10665,7 +10572,7 @@ MEDFileFields *MEDFileFields::buildSubPart(const int *startIds, const int *endId if(*i<0 || *i>=(int)_fields.size()) { std::ostringstream oss; oss << "MEDFileFields::buildSubPart : Invalid given id in input (" << *i << ") should be in [0," << _fields.size() << ") !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } fields[j]=_fields[*i]; } @@ -10801,7 +10708,7 @@ int MEDFileFields::getPosFromFieldName(const std::string& fieldName) const std::ostringstream oss; oss << "MEDFileFields::getPosFromFieldName : impossible to find field '" << tmp << "' in this ! Possibilities are : "; std::copy(poss.begin(),poss.end(),std::ostream_iterator(oss,", ")); oss << " !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + throw INTERP_KERNEL::Exception(oss.str()); } MEDFileFieldsIterator::MEDFileFieldsIterator(MEDFileFields *fs):_fs(fs),_iter_id(0),_nb_iter(0) diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index ff5391513..a748d0b09 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -786,9 +786,7 @@ namespace MEDCoupling MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; // MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldInt *field); - MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals); MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArray() const; public: MEDLOADER_EXPORT static DataArrayInt *ReturnSafelyDataArrayInt(MCAuto& arr); @@ -1082,17 +1080,15 @@ namespace MEDCoupling MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const; // MEDLOADER_EXPORT MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const; - MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const; + MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const; MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const; // MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field); - MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals); MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); - MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile); // MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArray(int iteration, int order) const; public: diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 6d7867e47..b50ddecbf 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -171,6 +171,10 @@ using namespace MEDCoupling; %newobject MEDCoupling::MEDFileIntFieldMultiTS::LoadSpecificEntities; %newobject MEDCoupling::MEDFileIntFieldMultiTS::getUndergroundDataArray; %newobject MEDCoupling::MEDFileIntFieldMultiTS::convertToDouble; +%newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevel; +%newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtTopLevel; +%newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel; +%newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevelOld; %newobject MEDCoupling::MEDFileAnyTypeField1TS::New; %newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy; @@ -2136,9 +2140,7 @@ namespace MEDCoupling MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception); // void setFieldNoProfileSBT(const MEDCouplingFieldInt *field) throw(INTERP_KERNEL::Exception); - void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception); void setFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); - void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception); @@ -2751,11 +2753,14 @@ namespace MEDCoupling static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception); // void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field) throw(INTERP_KERNEL::Exception); - void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception); void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); - void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception); MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldInt *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception); %extend { MEDFileIntFieldMultiTS() @@ -2791,56 +2796,6 @@ namespace MEDCoupling return self->simpleRepr(); } - PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception) - { - DataArrayInt *ret1=0; - MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception) - { - DataArrayInt *ret1=0; - MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception) - { - DataArrayInt *ret1=0; - MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception) - { - DataArrayInt *ret1=0; - MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - - PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception) - { - DataArrayInt *ret1=0; - MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception) { DataArrayInt *ret1=0; diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index 3b3823e80..0c6efa452 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -2595,7 +2595,7 @@ class MEDLoaderTest3(unittest.TestCase): self.assertEqual(ff2.getName(),"VectorFieldOnCells") self.assertEqual(ff2.getTime(),[0,1,2.0]) self.assertTrue(isinstance(ff2,MEDFileIntField1TS)) - a=ff1.getFieldOnMeshAtLevel(0,ON_CELLS,mm1) + a=ff1.getFieldOnMeshAtLevel(ON_CELLS,0,mm1) self.assertEqual(a.getArray().getInfoOnComponents(),['power [MW/m^3]','density [g/cm^3]','temperature [K]']) self.assertTrue(a.isEqual(f1,1e-12,1e-12)) ff2.setTime(1,2,3.) @@ -2605,9 +2605,9 @@ class MEDLoaderTest3(unittest.TestCase): self.assertEqual(ffs1.getTimeSteps(),[(0, 1, 2.0), (1, 2, 3.0)]) self.assertEqual(len(ffs1),2) self.assertTrue(isinstance(ffs1,MEDFileIntFieldMultiTS)) - a=ffs1[2.].getFieldOnMeshAtLevel(0,ON_CELLS,mm1) + a=ffs1[2.].getFieldOnMeshAtLevel(ON_CELLS,0,mm1) self.assertTrue(a.isEqual(f1,1e-12,1e-12)) - a=ffs1[2.].getFieldOnMeshAtLevel(0,ON_CELLS,mm1) + a=ffs1.getFieldOnMeshAtLevel(ON_CELLS,0,1,0,mm1) self.assertTrue(a.isEqual(f1,1e-12,1e-12)) it=ffs1.__iter__() ; it.next() ; ff2bis=it.next() a=ff2bis.getFieldOnMeshAtLevel(0,ON_CELLS,mm1) @@ -2616,29 +2616,29 @@ class MEDLoaderTest3(unittest.TestCase): self.assertTrue(a.isEqual(f1,1e-12,1e-12)) ; f1.getArray()[:]/=2 bc=DataArrayInt(6,3) ; bc[:]=0 ; bc.setInfoOnComponents(['power [MW/m^3]','density [g/cm^3]','temperature [K]']) for it in ffs1: - a=it.getFieldOnMeshAtLevel(0,ON_CELLS,mm1) + a=it.getFieldOnMeshAtLevel(ON_CELLS,0,mm1) bc+=a.getArray() pass self.assertTrue(bc.isEqual(3*f1.getArray())) - nf1=MEDCouplingFieldDouble(ON_NODES) + nf1=MEDCouplingFieldInt(ON_NODES) nf1.setTime(9.,10,-1) nf1.setMesh(f1.getMesh()) narr=DataArrayInt(12,2) ; narr.setInfoOnComponents(["aa [u1]","bbbvv [ppp]"]) ; narr[:,0]=range(12) ; narr[:,1]=2*narr[:,0] - nf1.setName("VectorFieldOnNodes") + nf1.setName("VectorFieldOnNodes") ; nf1.setArray(narr) nff1=MEDFileIntField1TS.New() - nff1.setFieldNoProfileSBT(nf1,narr) + nff1.setFieldNoProfileSBT(nf1) self.assertEqual(nff1.getInfo(),('aa [u1]','bbbvv [ppp]')) self.assertEqual(nff1.getTime(),[10,-1,9.0]) nff1.write(fname,0) # - nf2=MEDCouplingFieldDouble(ON_NODES) + nf2=MEDCouplingFieldInt(ON_NODES) nf2.setTime(19.,20,-11) nf2.setMesh(f1.getMesh()) narr2=DataArrayInt(8,2) ; narr.setInfoOnComponents(["aapfl [u1]","bbbvvpfl [ppp]"]) ; narr2[:,0]=range(8) ; narr2[:,0]+=10 ; narr2[:,1]=3*narr2[:,0] - nf2.setName("VectorFieldOnNodesPfl") ; narr2.setName(nf2.getName()) + nf2.setName("VectorFieldOnNodesPfl") ; narr2.setName(nf2.getName()) ; nf2.setArray(narr2) nff2=MEDFileIntField1TS.New() npfl=DataArrayInt([1,2,4,5,6,7,10,11]) ; npfl.setName("npfl") - nff2.setFieldProfile(nf2,narr2,mm1,0,npfl) + nff2.setFieldProfile(nf2,mm1,0,npfl) nff2.getFieldWithProfile(ON_NODES,0,mm1) a,b=nff2.getFieldWithProfile(ON_NODES,0,mm1) ; b.setName(npfl.getName()) self.assertTrue(b.isEqual(npfl)) @@ -5096,11 +5096,11 @@ class MEDLoaderTest3(unittest.TestCase): fmts=MEDFileIntFieldMultiTS() pflName="PFL" pfl=DataArrayInt([1,3,5]) ; pfl.setName(pflName) - f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(mesh) + f=MEDCouplingFieldInt(ON_CELLS) ; f.setMesh(mesh) fieldName="FieldOnCell" f.setTime(1.2,1,1) ; f.setName(fieldName) - arr=DataArrayInt([101,102,103]) - fmts.appendFieldProfile(f,arr,mm,0,pfl) + arr=DataArrayInt([101,102,103]) ; f.setArray(arr) + fmts.appendFieldProfile(f,mm,0,pfl) # mm.write(fname,2) fmts.write(fname,0) -- 2.39.2