bool MEDCouplingField::isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const
{
+ if(!other)
+ throw INTERP_KERNEL::Exception("MEDCouplingField::isEqualWithoutConsideringStr : input field is NULL !");
+ if(!_type)
+ throw INTERP_KERNEL::Exception("MEDCouplingField::isEqualWithoutConsideringStr : spatial discretization of this is NULL !");
if(!_type->isEqualWithoutConsideringStr(other->_type,valsPrec))
return false;
if(_nature!=other->_nature)
*/
bool MEDCouplingField::areCompatibleForMerge(const MEDCouplingField *other) const
{
+ if(!other)
+ throw INTERP_KERNEL::Exception("MEDCouplingField::areCompatibleForMerge : input field is NULL !");
if(!_type->isEqual(other->_type,1.))
return false;
if(_nature!=other->_nature)
*/
bool MEDCouplingField::areStrictlyCompatible(const MEDCouplingField *other) const
{
+ if(!other)
+ throw INTERP_KERNEL::Exception("MEDCouplingField::areStrictlyCompatible : input field is NULL !");
if(!_type->isEqual(other->_type,1.e-12))
return false;
if(_nature!=other->_nature)
*/
void MEDCouplingField::setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception)
{
+ MEDCouplingNatureOfField::GetRepr(nat);//generate a throw if nat not recognized
_nature=nat;
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("MEDCouplingField::getLocalizationOfDiscr : No mesh set !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("MEDCouplingField::getLocalizationOfDiscr : No spatial discretization set !");
return _type->getLocalizationOfDiscValues(_mesh);
}
*/
MEDCouplingFieldDouble *MEDCouplingField::buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception)
{
- if(_mesh==0)
- throw INTERP_KERNEL::Exception("MEDCouplingField::getMeasureField : no mesh defined !!!");
+ if(!_mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingField::buildMeasureField : no mesh defined !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("MEDCouplingField::buildMeasureField : No spatial discretization set !");
return _type->getMeasureField(_mesh,isAbs);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling setGaussLocalizationOnType method !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call setGaussLocalizationOnType method !");
_type->setGaussLocalizationOnType(_mesh,type,refCoo,gsCoo,wg);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling setGaussLocalizationOnCells method !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call setGaussLocalizationOnCells method !");
_type->setGaussLocalizationOnCells(_mesh,begin,end,refCoo,gsCoo,wg);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling clearGaussLocalizations method !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call clearGaussLocalizations method !");
_type->clearGaussLocalizations();
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalization method !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalization method !");
return _type->getGaussLocalization(locId);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalizationIdOfOneType method !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneType method !");
return _type->getGaussLocalizationIdOfOneType(type);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalizationIdsOfOneType method !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdsOfOneType method !");
return _type->getGaussLocalizationIdsOfOneType(type);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling getNbOfGaussLocalization method !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNbOfGaussLocalization method !");
return _type->getNbOfGaussLocalization();
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalizationIdOfOneCell method !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalizationIdOfOneCell method !");
return _type->getGaussLocalizationIdOfOneCell(cellId);
}
cellIds.clear();
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalizationIdOfOneCell method !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getCellIdsHavingGaussLocalization method !");
_type->getCellIdsHavingGaussLocalization(locId,cellIds);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Mesh has to be set before calling getGaussLocalization method !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getGaussLocalization method !");
return _type->getGaussLocalization(locId);
}
*/
MEDCouplingMesh *MEDCouplingField::buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call buildSubMeshData method !");
return _type->buildSubMeshData(_mesh,start,end,di);
}
*/
DataArrayInt *MEDCouplingField::computeTupleIdsToSelectFromCellIds(const int *startCellIds, const int *endCellIds) const
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call computeTupleIdsToSelectFromCellIds method !");
return _type->computeTupleIdsToSelectFromCellIds(_mesh,startCellIds,endCellIds);
}
*/
int MEDCouplingField::getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNumberOfTuplesExpected method !");
if(_mesh)
return _type->getNumberOfTuples(_mesh);
else
void MEDCouplingField::setDiscretization(MEDCouplingFieldDiscretization *newDisc)
{
+ bool needUpdate=(const MEDCouplingFieldDiscretization *)_type!=newDisc;
_type=newDisc;
if(newDisc)
newDisc->incrRef();
+ if(needUpdate)
+ declareAsNew();
}
/*!
*/
int MEDCouplingField::getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Spatial discretization not set ! Impossible to call getNumberOfMeshPlacesExpected method !");
if(_mesh)
return _type->getNumberOfMeshPlaces(_mesh);
else
bool MEDCouplingFieldDiscretizationP0::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
+ if(!other)
+ {
+ reason="other spatial discretization is NULL, and this spatial discretization (P0) is defined.";
+ return false;
+ }
const MEDCouplingFieldDiscretizationP0 *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationP0 *>(other);
bool ret=otherC!=0;
if(!ret)
int MEDCouplingFieldDiscretizationP0::getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfTuples : NULL input mesh !");
return mesh->getNumberOfCells();
}
int MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getNumberOfMeshPlaces : NULL input mesh !");
return mesh->getNumberOfCells();
}
DataArrayInt *MEDCouplingFieldDiscretizationP0::getOffsetArr(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getOffsetArr : NULL input mesh !");
int nbOfTuples=mesh->getNumberOfCells();
DataArrayInt *ret=DataArrayInt::New();
ret->alloc(nbOfTuples+1,1);
void MEDCouplingFieldDiscretizationP0::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::renumberArraysForCell : NULL input mesh !");
const int *array=old2NewBg;
if(check)
array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
DataArrayDouble *MEDCouplingFieldDiscretizationP0::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getLocalizationOfDiscValues : NULL input mesh !");
return mesh->getBarycenterAndOwner();
}
void MEDCouplingFieldDiscretizationP0::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::checkCoherencyBetween : NULL input mesh !");
if(mesh->getNumberOfCells()!=da->getNumberOfTuples())
{
std::ostringstream message;
void MEDCouplingFieldDiscretizationP0::getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getValueOn : NULL input mesh !");
int id=mesh->getCellContainingPoint(loc,_precision);
if(id==-1)
throw INTERP_KERNEL::Exception("Specified point is detected outside of mesh : unable to apply P0::getValueOn !");
DataArrayDouble *MEDCouplingFieldDiscretizationP0::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::getValueOnMulti : NULL input mesh !");
std::vector<int> elts,eltsIndex;
mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,elts,eltsIndex);
int spaceDim=mesh->getSpaceDimension();
*/
MEDCouplingMesh *MEDCouplingFieldDiscretizationP0::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP0::buildSubMeshData : NULL input mesh !");
MEDCouplingMesh *ret=mesh->buildPart(start,end);
di=DataArrayInt::New();
di->alloc((int)std::distance(start,end),1);
int MEDCouplingFieldDiscretizationOnNodes::getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getNumberOfTuples : NULL input mesh !");
return mesh->getNumberOfNodes();
}
int MEDCouplingFieldDiscretizationOnNodes::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getNumberOfMeshPlaces : NULL input mesh !");
return mesh->getNumberOfNodes();
}
DataArrayInt *MEDCouplingFieldDiscretizationOnNodes::getOffsetArr(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getOffsetArr : NULL input mesh !");
int nbOfTuples=mesh->getNumberOfNodes();
DataArrayInt *ret=DataArrayInt::New();
ret->alloc(nbOfTuples+1,1);
DataArrayDouble *MEDCouplingFieldDiscretizationOnNodes::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::getLocalizationOfDiscValues : NULL input mesh !");
return mesh->getCoordinatesAndOwner();
}
void MEDCouplingFieldDiscretizationOnNodes::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::checkCoherencyBetween : NULL input mesh !");
if(mesh->getNumberOfNodes()!=da->getNumberOfTuples())
{
std::ostringstream message;
*/
MEDCouplingMesh *MEDCouplingFieldDiscretizationOnNodes::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationNodes::buildSubMeshData : NULL input mesh !");
MEDCouplingMesh *ret=mesh->buildPartAndReduceNodes(start,end,di);
DataArrayInt *di2=di->invertArrayO2N2N2O(ret->getNumberOfNodes());
di->decrRef();
DataArrayInt *MEDCouplingFieldDiscretizationOnNodes::computeTupleIdsToSelectFromCellIds(const MEDCouplingMesh *mesh, const int *startCellIds, const int *endCellIds) const
{
if(!mesh)
- throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::computeTupleIdsToSelectFromCellIds : null mesh !");
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::computeTupleIdsToSelectFromCellIds : NULL input mesh !");
const MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> umesh=mesh->buildUnstructured();
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> umesh2=static_cast<MEDCouplingUMesh *>(umesh->buildPartOfMySelf(startCellIds,endCellIds,true));
return umesh2->computeFetchedNodeIds();
bool MEDCouplingFieldDiscretizationP1::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
+ if(!other)
+ {
+ reason="other spatial discretization is NULL, and this spatial discretization (P1) is defined.";
+ return false;
+ }
const MEDCouplingFieldDiscretizationP1 *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationP1 *>(other);
bool ret=otherC!=0;
if(!ret)
void MEDCouplingFieldDiscretizationP1::getValueOn(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, double *res) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueOn : NULL input mesh !");
int id=mesh->getCellContainingPoint(loc,_precision);
if(id==-1)
throw INTERP_KERNEL::Exception("Specified point is detected outside of mesh : unable to apply P1::getValueOn !");
*/
void MEDCouplingFieldDiscretizationP1::getValueInCell(const MEDCouplingMesh *mesh, int cellId, const DataArrayDouble *arr, const double *loc, double *res) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueInCell : NULL input mesh !");
std::vector<int> conn;
std::vector<double> coo;
mesh->getNodeIdsOfCell(cellId,conn);
DataArrayDouble *MEDCouplingFieldDiscretizationP1::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfPoints) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationP1::getValueOnMulti : NULL input mesh !");
std::vector<int> elts,eltsIndex;
mesh->getCellsContainingPoints(loc,nbOfPoints,_precision,elts,eltsIndex);
int spaceDim=mesh->getSpaceDimension();
{
if(!_discr_per_cell)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has no discretization per cell !");
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween : NULL input mesh !");
int nbOfTuples=_discr_per_cell->getNumberOfTuples();
if(nbOfTuples!=mesh->getNumberOfCells())
throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell has a discretization per cell but it's not matching the underlying mesh !");
bool MEDCouplingFieldDiscretizationPerCell::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
+ if(!other)
+ {
+ reason="other spatial discretization is NULL, and this spatial discretization (PerCell) is defined.";
+ return false;
+ }
const MEDCouplingFieldDiscretizationPerCell *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationPerCell *>(other);
if(!otherC)
{
- reason="Spatial discrtization of this is ON_GAUSS, which is not the case of other.";
+ reason="Spatial discretization of this is ON_GAUSS, which is not the case of other.";
return false;
}
if(_discr_per_cell==0)
delete [] const_cast<int *>(array);
}
-void MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary(const MEDCouplingMesh *m)
+void MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary(const MEDCouplingMesh *mesh)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationPerCell::buildDiscrPerCellIfNecessary : NULL input mesh !");
if(!_discr_per_cell)
{
_discr_per_cell=DataArrayInt::New();
- int nbTuples=m->getNumberOfCells();
+ int nbTuples=mesh->getNumberOfCells();
_discr_per_cell->alloc(nbTuples,1);
int *ptr=_discr_per_cell->getPointer();
std::fill(ptr,ptr+nbTuples,DFT_INVALID_LOCID_VALUE);
bool MEDCouplingFieldDiscretizationGauss::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
+ if(!other)
+ {
+ reason="other spatial discretization is NULL, and this spatial discretization (Gauss) is defined.";
+ return false;
+ }
const MEDCouplingFieldDiscretizationGauss *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationGauss *>(other);
if(!otherC)
{
int MEDCouplingFieldDiscretizationGauss::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getNumberOfMeshPlaces : NULL input mesh !");
return mesh->getNumberOfCells();
}
DataArrayInt *MEDCouplingFieldDiscretizationGauss::getOffsetArr(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getOffsetArr : NULL input mesh !");
int nbOfTuples=mesh->getNumberOfCells();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbOfTuples+1,1);
void MEDCouplingFieldDiscretizationGauss::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::renumberArraysForCell : NULL input mesh !");
const int *array=old2NewBg;
if(check)
array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
DataArrayDouble *MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::getLocalizationOfDiscValues : NULL input mesh !");
checkNoOrphanCells();
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> umesh=mesh->buildUnstructured();//in general do nothing
int nbOfTuples=getNumberOfTuples(mesh);
void MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween(const MEDCouplingMesh *mesh, const DataArrayDouble *da) const throw(INTERP_KERNEL::Exception)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::checkCoherencyBetween : NULL input mesh !");
MEDCouplingFieldDiscretizationPerCell::checkCoherencyBetween(mesh,da);
for(std::vector<MEDCouplingGaussLocalization>::const_iterator iter=_loc.begin();iter!=_loc.end();iter++)
(*iter).checkCoherency();
MEDCouplingMesh *MEDCouplingFieldDiscretizationGauss::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::buildSubMeshData : NULL input mesh !");
di=computeTupleIdsToSelectFromCellIds(mesh,start,end);
return mesh->buildPart(start,end);
}
throw INTERP_KERNEL::Exception("Number of cells has changed and becomes higher with some cells that have been split ! Unable to conserve the Gauss field !");
}
-void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
+void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType(const MEDCouplingMesh *mesh, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType : NULL input mesh !");
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
- if((int)cm.getDimension()!=m->getMeshDimension())
+ if((int)cm.getDimension()!=mesh->getMeshDimension())
{
- std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType : mismatch of dimensions ! MeshDim==" << m->getMeshDimension();
+ std::ostringstream oss; oss << "MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnType : mismatch of dimensions ! MeshDim==" << mesh->getMeshDimension();
oss << " whereas Type '" << cm.getRepr() << "' has dimension " << cm.getDimension() << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- buildDiscrPerCellIfNecessary(m);
+ buildDiscrPerCellIfNecessary(mesh);
int id=(int)_loc.size();
MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg);
_loc.push_back(elt);
int *ptr=_discr_per_cell->getPointer();
- int nbCells=m->getNumberOfCells();
+ int nbCells=mesh->getNumberOfCells();
for(int i=0;i<nbCells;i++)
- if(m->getTypeOfCell(i)==type)
+ if(mesh->getTypeOfCell(i)==type)
ptr[i]=id;
zipGaussLocalizations();
}
-void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDCouplingMesh *m, const int *begin, const int *end, const std::vector<double>& refCoo,
+void MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const int *begin, const int *end, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception)
{
- buildDiscrPerCellIfNecessary(m);
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGauss::setGaussLocalizationOnCells : NULL input mesh !");
+ buildDiscrPerCellIfNecessary(mesh);
if(std::distance(begin,end)<1)
throw INTERP_KERNEL::Exception("Size of [begin,end) must be equal or greater than 1 !");
- INTERP_KERNEL::NormalizedCellType type=m->getTypeOfCell(*begin);
+ INTERP_KERNEL::NormalizedCellType type=mesh->getTypeOfCell(*begin);
MEDCouplingGaussLocalization elt(type,refCoo,gsCoo,wg);
int id=(int)_loc.size();
int *ptr=_discr_per_cell->getPointer();
for(const int *w=begin+1;w!=end;w++)
{
- if(m->getTypeOfCell(*w)!=type)
+ if(mesh->getTypeOfCell(*w)!=type)
{
std::ostringstream oss; oss << "The cell with id " << *w << " has been detected to be incompatible in the [begin,end) array specified !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
bool MEDCouplingFieldDiscretizationGaussNE::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
+ if(!other)
+ {
+ reason="other spatial discretization is NULL, and this spatial discretization (GaussNE) is defined.";
+ return false;
+ }
const MEDCouplingFieldDiscretizationGaussNE *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationGaussNE *>(other);
bool ret=otherC!=0;
if(!ret)
int MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples(const MEDCouplingMesh *mesh) const throw(INTERP_KERNEL::Exception)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfTuples : NULL input mesh !");
int ret=0;
int nbOfCells=mesh->getNumberOfCells();
for(int i=0;i<nbOfCells;i++)
int MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getNumberOfMeshPlaces : NULL input mesh !");
return mesh->getNumberOfCells();
}
DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::getOffsetArr(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getOffsetArr : NULL input mesh !");
int nbOfTuples=mesh->getNumberOfCells();
DataArrayInt *ret=DataArrayInt::New();
ret->alloc(nbOfTuples+1,1);
void MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::renumberArraysForCell : NULL input mesh !");
const int *array=old2NewBg;
if(check)
array=DataArrayInt::CheckAndPreparePermutation(old2NewBg,old2NewBg+mesh->getNumberOfCells());
DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscValues : NULL input mesh !");
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> umesh=mesh->buildUnstructured();//in general do nothing
int nbOfTuples=getNumberOfTuples(umesh);
double MEDCouplingFieldDiscretizationGaussNE::getIJK(const MEDCouplingMesh *mesh, const DataArrayDouble *da,
int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception)
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::getIJK : NULL input mesh !");
int offset=0;
for(int i=0;i<cellId;i++)
{
MEDCouplingMesh *MEDCouplingFieldDiscretizationGaussNE::buildSubMeshData(const MEDCouplingMesh *mesh, const int *start, const int *end, DataArrayInt *&di) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::buildSubMeshData : NULL input mesh !");
di=computeTupleIdsToSelectFromCellIds(mesh,start,end);
return mesh->buildPart(start,end);
}
bool MEDCouplingFieldDiscretizationKriging::isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const
{
+ if(!other)
+ {
+ reason="other spatial discretization is NULL, and this spatial discretization (Kriginig) is defined.";
+ return false;
+ }
const MEDCouplingFieldDiscretizationKriging *otherC=dynamic_cast<const MEDCouplingFieldDiscretizationKriging *>(other);
bool ret=otherC!=0;
if(!ret)
DataArrayDouble *MEDCouplingFieldDiscretizationKriging::getValueOnMulti(const DataArrayDouble *arr, const MEDCouplingMesh *mesh, const double *loc, int nbOfTargetPoints) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::getValueOnMulti : NULL input mesh !");
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coords=getLocalizationOfDiscValues(mesh);
int nbOfPts=coords->getNumberOfTuples();
int dimension=coords->getNumberOfComponents();
*/
DataArrayDouble *MEDCouplingFieldDiscretizationKriging::computeVectorOfCoefficients(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, int& isDrift) const
{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationKriging::computeVectorOfCoefficients : NULL input mesh !");
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coords=getLocalizationOfDiscValues(mesh);
int nbOfPts=coords->getNumberOfTuples();
//int dimension=coords->getNumberOfComponents();
bool isEqualWithoutConsideringStr(const MEDCouplingFieldDiscretization *other, double eps) const;
void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
protected:
- void buildDiscrPerCellIfNecessary(const MEDCouplingMesh *m);
+ void buildDiscrPerCellIfNecessary(const MEDCouplingMesh *mesh);
protected:
DataArrayInt *_discr_per_cell;
static const int DFT_INVALID_LOCID_VALUE;
void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const;
void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const;
void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
- void setGaussLocalizationOnType(const MEDCouplingMesh *m, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
+ void setGaussLocalizationOnType(const MEDCouplingMesh *mesh, INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
- void setGaussLocalizationOnCells(const MEDCouplingMesh *m, const int *begin, const int *end, const std::vector<double>& refCoo,
+ void setGaussLocalizationOnCells(const MEDCouplingMesh *mesh, const int *begin, const int *end, const std::vector<double>& refCoo,
const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
void clearGaussLocalizations() throw(INTERP_KERNEL::Exception);
void setGaussLocalization(int locId, const MEDCouplingGaussLocalization& loc) throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const
{
MEDCouplingTimeDiscretization *tdo=_time_discr->buildNewTimeReprFromThis(td,deepCopy);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),tdo,_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDiscretization> disc;
+ if(_type)
+ disc=_type->clone();
+ MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),tdo,disc.retn());
ret->setMesh(getMesh());
ret->setName(getName());
ret->setDescription(getDescription());
std::ostringstream ret;
ret << "FieldDouble with name : \"" << getName() << "\"\n";
ret << "Description of field is : \"" << getDescription() << "\"\n";
- ret << "FieldDouble space discretization is : " << _type->getStringRepr() << "\n";
- ret << "FieldDouble time discretization is : " << _time_discr->getStringRepr() << "\n";
+ if(_type)
+ { ret << "FieldDouble space discretization is : " << _type->getStringRepr() << "\n"; }
+ else
+ { ret << "FieldDouble has no space discretization set !\n"; }
+ if(_time_discr)
+ { ret << "FieldDouble time discretization is : " << _time_discr->getStringRepr() << "\n"; }
+ else
+ { ret << "FieldDouble has no time discretization set !\n"; }
if(getArray())
ret << "FieldDouble default array has " << getArray()->getNumberOfComponents() << " components and " << getArray()->getNumberOfTuples() << " tuples.\n";
if(_mesh)
void MEDCouplingFieldDouble::renumberCellsWithoutMesh(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception)
{
if(!_mesh)
- throw INTERP_KERNEL::Exception("Expecting a defined mesh to be able to operate a renumbering !");
+ throw INTERP_KERNEL::Exception("Expecting a defined mesh to be able to operate a renumbering !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Expecting a spatial discretization to be able to operate a renumbering !");
//
_type->renumberCells(old2NewBg,check);
std::vector<DataArrayDouble *> arrays;
*/
void MEDCouplingFieldDouble::renumberNodesWithoutMesh(const int *old2NewBg, int newNbOfNodes, double eps) throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("Expecting a spatial discretization to be able to operate a renumbering !");
std::vector<DataArrayDouble *> arrays;
_time_discr->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildSubPart(const int *partBg, const int *partEnd) const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::buildSubPart : Expecting a not NULL spatial discretization !");
DataArrayInt *arrSelect;
MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=_type->buildSubMeshData(_mesh,partBg,partEnd,arrSelect);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arrSelect2(arrSelect);
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Field invalid because no mesh specified !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::checkCoherency : no spatial discretization !");
_time_discr->checkCoherency();
_type->checkCoherencyBetween(_mesh,getArray());
}
double MEDCouplingFieldDouble::normL1(int compId) const throw(INTERP_KERNEL::Exception)
{
if(!_mesh)
- throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL1");
+ throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL1 !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL1 !");
int nbComps=getArray()->getNumberOfComponents();
if(compId<0 || compId>=nbComps)
{
{
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL1");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL1 !");
_type->normL1(_mesh,getArray(),res);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL2");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL2 !");
int nbComps=getArray()->getNumberOfComponents();
if(compId<0 || compId>=nbComps)
{
{
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform normL2");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform normL2 !");
_type->normL2(_mesh,getArray(),res);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform integral");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform integral !");
int nbComps=getArray()->getNumberOfComponents();
if(compId<0 || compId>=nbComps)
{
{
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform integral2");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform integral2 !");
_type->integral(_mesh,getArray(),isWAbs,res);
}
const DataArrayDouble *arr=_time_discr->getArray();
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOnPos");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getValueOnPos !");
_type->getValueOnPos(arr,_mesh,i,j,k,res);
}
const DataArrayDouble *arr=_time_discr->getArray();
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOn");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getValueOnPos !");
_type->getValueOn(arr,_mesh,spaceLoc,res);
}
const DataArrayDouble *arr=_time_discr->getArray();
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOnMulti");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getValueOnMulti !");
return _type->getValueOnMulti(arr,_mesh,spaceLoc,nbOfPoints);
}
std::vector< const DataArrayDouble *> arrs=_time_discr->getArraysForTime(time);
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOn");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getValueOn !");
std::vector<double> res2;
for(std::vector< const DataArrayDouble *>::const_iterator iter=arrs.begin();iter!=arrs.end();iter++)
{
{
if(!_mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::operator= : no mesh defined !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform operator = !");
int nbOfTuple=_type->getNumberOfTuples(_mesh);
_time_discr->setUniformValue(nbOfTuple,1,value);
return *this;
{
if(!_mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic : no mesh defined !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalytic !");
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
_time_discr->fillFromAnalytic(loc,nbOfComp,func);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic : no mesh defined !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalytic !");
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
_time_discr->fillFromAnalytic(loc,nbOfComp,func);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalytic2 !");
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
_time_discr->fillFromAnalytic2(loc,nbOfComp,func);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalytic3 !");
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
_time_discr->fillFromAnalytic3(loc,nbOfComp,varsOrder,func);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::applyFunc : no mesh defined !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform applyFunc !");
int nbOfTuple=_type->getNumberOfTuples(_mesh);
_time_discr->setUniformValue(nbOfTuple,nbOfComp,val);
}
{
if(!_mesh)
throw INTERP_KERNEL::Exception("Impossible to retrieve number of tuples because no mesh specified !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getNumberOfTuples !");
return _type->getNumberOfTuples(_mesh);
}
void MEDCouplingFieldDouble::setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception)
{
MEDCouplingField::setNature(nat);
- _type->checkCompatibilityWithNature(nat);
+ if(_type)
+ _type->checkCompatibilityWithNature(nat);
}
/*!
double MEDCouplingFieldDouble::getIJK(int cellId, int nodeIdInCell, int compoId) const
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getIJK !");
return _type->getIJK(_mesh,getArray(),cellId,nodeIdInCell,compoId);
}
*/
void MEDCouplingFieldDouble::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationIntInformation !");
tinyInfo.clear();
tinyInfo.push_back((int)_type->getEnum());
tinyInfo.push_back((int)_time_discr->getEnum());
*/
void MEDCouplingFieldDouble::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationDbleInformation !");
tinyInfo.clear();
_time_discr->getTinySerializationDbleInformation(tinyInfo);
std::vector<double> tinyInfo2;
*/
void MEDCouplingFieldDouble::resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt, std::vector<DataArrayDouble *>& arrays)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !");
dataInt=0;
std::vector<int> tinyInfoITmp(tinyInfoI);
int sz=tinyInfoITmp.back();
void MEDCouplingFieldDouble::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform finishUnserialization !");
std::vector<int> tinyInfoI2(tinyInfoI.begin()+3,tinyInfoI.end());
//
std::vector<double> tmp(tinyInfoD);
*/
void MEDCouplingFieldDouble::serialize(DataArrayInt *&dataInt, std::vector<DataArrayDouble *>& arrays) const
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform serialize !");
_time_discr->getArrays(arrays);
_type->getSerializationIntArray(dataInt);
}
const MEDCouplingPointSet *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("Invalid support mesh to apply mergeNodes on it : must be a MEDCouplingPointSet one !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodes !");
MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCpy());
bool ret;
int ret2;
const MEDCouplingPointSet *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("Invalid support mesh to apply mergeNodes on it : must be a MEDCouplingPointSet one !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform mergeNodes2 !");
MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCpy());
bool ret;
int ret2;
const MEDCouplingPointSet *meshC=dynamic_cast<const MEDCouplingPointSet *>(_mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::zipCoords : Invalid support mesh to apply zipCoords on it : must be a MEDCouplingPointSet one !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipCoords !");
MEDCouplingAutoRefCountObjectPtr<MEDCouplingPointSet> meshC2((MEDCouplingPointSet *)meshC->deepCpy());
int oldNbOfNodes=meshC2->getNumberOfNodes();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=meshC2->zipCoordsTraducer();
const MEDCouplingUMesh *meshC=dynamic_cast<const MEDCouplingUMesh *>(_mesh);
if(!meshC)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::zipCoords : Invalid support mesh to apply zipCoords on it : must be a MEDCouplingPointSet one !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform zipConnectivity !");
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> meshC2((MEDCouplingUMesh *)meshC->deepCpy());
int oldNbOfCells=meshC2->getNumberOfCells();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=meshC2->zipConnectivityTraducer(compType);
*/
bool MEDCouplingFieldDouble::simplexize(int policy) throw(INTERP_KERNEL::Exception)
{
+ if(!_mesh)
+ throw INTERP_KERNEL::Exception("No underlying mesh on this field to perform simplexize !");
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform simplexize !");
int oldNbOfCells=_mesh->getNumberOfCells();
MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> meshC2(_mesh->deepCpy());
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=meshC2->simplexize(policy);
MEDCouplingFieldDouble *MEDCouplingFieldDouble::doublyContractedProduct() const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform doublyContractedProduct !");
MEDCouplingTimeDiscretization *td=_time_discr->doublyContractedProduct();
td->copyTinyAttrFrom(*_time_discr);
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
MEDCouplingFieldDouble *MEDCouplingFieldDouble::determinant() const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform determinant !");
MEDCouplingTimeDiscretization *td=_time_discr->determinant();
td->copyTinyAttrFrom(*_time_discr);
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
MEDCouplingFieldDouble *MEDCouplingFieldDouble::eigenValues() const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform eigenValues !");
MEDCouplingTimeDiscretization *td=_time_discr->eigenValues();
td->copyTinyAttrFrom(*_time_discr);
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
MEDCouplingFieldDouble *MEDCouplingFieldDouble::eigenVectors() const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform eigenVectors !");
MEDCouplingTimeDiscretization *td=_time_discr->eigenVectors();
td->copyTinyAttrFrom(*_time_discr);
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
MEDCouplingFieldDouble *MEDCouplingFieldDouble::inverse() const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform inverse !");
MEDCouplingTimeDiscretization *td=_time_discr->inverse();
td->copyTinyAttrFrom(*_time_discr);
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
MEDCouplingFieldDouble *MEDCouplingFieldDouble::trace() const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform trace !");
MEDCouplingTimeDiscretization *td=_time_discr->trace();
td->copyTinyAttrFrom(*_time_discr);
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
MEDCouplingFieldDouble *MEDCouplingFieldDouble::deviator() const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform deviator !");
MEDCouplingTimeDiscretization *td=_time_discr->deviator();
td->copyTinyAttrFrom(*_time_discr);
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
MEDCouplingFieldDouble *MEDCouplingFieldDouble::magnitude() const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform magnitude !");
MEDCouplingTimeDiscretization *td=_time_discr->magnitude();
td->copyTinyAttrFrom(*_time_discr);
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
MEDCouplingFieldDouble *MEDCouplingFieldDouble::maxPerTuple() const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform maxPerTuple !");
MEDCouplingTimeDiscretization *td=_time_discr->maxPerTuple();
td->copyTinyAttrFrom(*_time_discr);
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform keepSelectedComponents !");
MEDCouplingTimeDiscretization *td=_time_discr->keepSelectedComponents(compoIds);
td->copyTinyAttrFrom(*_time_discr);
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply MergeFields on them !");
const MEDCouplingMesh *m1=f1->getMesh();
const MEDCouplingMesh *m2=f2->getMesh();
+ if(!m1)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MergeFields : no underlying mesh of f1 !");
+ if(!f1->_time_discr)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MergeFields : no time discr of f1 !");
+ if(!f1->_type)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MergeFields : no spatial discr of f1 !");
MEDCouplingMesh *m=m1->mergeMyselfWith(m2);
MEDCouplingTimeDiscretization *td=f1->_time_discr->aggregate(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
std::vector< const MEDCouplingTimeDiscretization *> tds(a.size());
std::vector<const MEDCouplingFieldDouble *>::const_iterator it=a.begin();
const MEDCouplingFieldDouble *ref=(*it++);
+ if(!ref)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MergeFields : presence of NULL instance in first place of input vector !");
for(;it!=a.end();it++)
if(!ref->areCompatibleForMerge(*it))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply MergeFields on them !");
MEDCouplingFieldDouble *MEDCouplingFieldDouble::DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
{
+ if(!f1)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::DotFields : input field is NULL !");
if(!f1->areStrictlyCompatible(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply DotFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->dot(f2->_time_discr);
MEDCouplingFieldDouble *MEDCouplingFieldDouble::CrossProductFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
{
+ if(!f1)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::CrossProductFields : input field is NULL !");
if(!f1->areStrictlyCompatible(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply CrossProductFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->crossProduct(f2->_time_discr);
MEDCouplingFieldDouble *MEDCouplingFieldDouble::MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
{
+ if(!f1)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MaxFields : input field is NULL !");
if(!f1->areStrictlyCompatible(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply MaxFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->max(f2->_time_discr);
MEDCouplingFieldDouble *MEDCouplingFieldDouble::MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
{
+ if(!f1)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MinFields : input field is NULL !");
if(!f1->areStrictlyCompatible(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply MinFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->min(f2->_time_discr);
MEDCouplingFieldDouble *MEDCouplingFieldDouble::AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
{
+ if(!f1)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::AddFields : input field is NULL !");
if(!f1->areStrictlyCompatible(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply AddFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->add(f2->_time_discr);
MEDCouplingFieldDouble *MEDCouplingFieldDouble::SubstractFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
{
+ if(!f1)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::SubstractFields : input field is NULL !");
if(!f1->areStrictlyCompatible(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply SubstractFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->substract(f2->_time_discr);
MEDCouplingFieldDouble *MEDCouplingFieldDouble::MultiplyFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
{
+ if(!f1)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MultiplyFields : input field is NULL !");
if(!f1->areCompatibleForMul(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply MultiplyFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->multiply(f2->_time_discr);
MEDCouplingFieldDouble *MEDCouplingFieldDouble::DivideFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
{
+ if(!f1)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::DivideFields : input field is NULL !");
if(!f1->areCompatibleForDiv(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply DivideFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->divide(f2->_time_discr);
if(fs.empty())
return;
std::size_t nfs=fs.size();
+ if(!fs[0])
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::WriteVTK : 1st instance of field is NULL !");
const MEDCouplingMesh *m=fs[0]->getMesh();
+ if(!m)
+ throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::WriteVTK : 1st instance of field lies on NULL mesh !");
for(std::size_t i=1;i<nfs;i++)
if(fs[i]->getMesh()!=m)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::WriteVTK : Fields are not lying on a same mesh ! Expected by VTK ! MEDCouplingFieldDouble::setMesh or MEDCouplingFieldDouble::changeUnderlyingMesh can help to that.");
void MEDCouplingFieldTemplate::getTinySerializationIntInformation(std::vector<int>& tinyInfo) const
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationIntInformation !");
tinyInfo.clear();
tinyInfo.push_back((int)_type->getEnum());
tinyInfo.push_back((int)_nature);
void MEDCouplingFieldTemplate::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationDbleInformation !");
tinyInfo.clear();
_type->getTinySerializationDbleInformation(tinyInfo);
}
void MEDCouplingFieldTemplate::resizeForUnserialization(const std::vector<int>& tinyInfoI, DataArrayInt *&dataInt)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform resizeForUnserialization !");
dataInt=0;
std::vector<int> tinyInfoITmp(tinyInfoI.begin()+2,tinyInfoI.end());
_type->resizeForUnserialization(tinyInfoITmp,dataInt);
void MEDCouplingFieldTemplate::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<double>& tinyInfoD, const std::vector<std::string>& tinyInfoS)
{
+ if(!((const MEDCouplingFieldDiscretization *)_type))
+ throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform finishUnserialization !");
_nature=(NatureOfField)tinyInfoI[1];
_type->finishUnserialization(tinyInfoD);
_name=tinyInfoS[0];