/// @cond INTERNAL
const INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::MEDMEM_ORDER[N_MEDMEM_ORDER] = { INTERP_KERNEL::NORM_POINT1, INTERP_KERNEL::NORM_SEG2, INTERP_KERNEL::NORM_SEG3, INTERP_KERNEL::NORM_SEG4, INTERP_KERNEL::NORM_POLYL, INTERP_KERNEL::NORM_TRI3, INTERP_KERNEL::NORM_QUAD4, INTERP_KERNEL::NORM_TRI6, INTERP_KERNEL::NORM_TRI7, INTERP_KERNEL::NORM_QUAD8, INTERP_KERNEL::NORM_QUAD9, INTERP_KERNEL::NORM_POLYGON, INTERP_KERNEL::NORM_QPOLYG, INTERP_KERNEL::NORM_TETRA4, INTERP_KERNEL::NORM_PYRA5, INTERP_KERNEL::NORM_PENTA6, INTERP_KERNEL::NORM_HEXA8, INTERP_KERNEL::NORM_HEXGP12, INTERP_KERNEL::NORM_TETRA10, INTERP_KERNEL::NORM_PYRA13, INTERP_KERNEL::NORM_PENTA15, INTERP_KERNEL::NORM_HEXA20, INTERP_KERNEL::NORM_HEXA27, INTERP_KERNEL::NORM_POLYHED };
+const int MEDCouplingUMesh::MEDCOUPLING2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]={1,3,21,5,9,7,22,34,23,28,-1,-1,-1,-1,10,14,13,-1,12,-1,24,-1,16,27,-1,26,-1,29,-1,-1,25,42,36,4};
/// @endcond
MEDCouplingUMesh *MEDCouplingUMesh::New()
{
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())
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)
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++)
{
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());
}
}
}
{
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;
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());
}
}
const INTERP_KERNEL::CellModel& _cm;
};
+class MicroEdgesGenerator2D
+{
+public:
+ MicroEdgesGenerator2D(const INTERP_KERNEL::CellModel& cm):_cm(cm) { }
+ unsigned getNumberOfSons2(const int *conn, int lgth) const { return _cm.getNumberOfMicroEdges(); }
+ unsigned fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillMicroEdgeNodalConnectivity(sonId,nodalConn,sonNodalConn,typeOfSon); }
+ static const int DELTA=1;
+private:
+ const INTERP_KERNEL::CellModel& _cm;
+};
+
+class MicroEdgesGenerator3D
+{
+public:
+ MicroEdgesGenerator3D(const INTERP_KERNEL::CellModel& cm):_cm(cm) { }
+ unsigned getNumberOfSons2(const int *conn, int lgth) const { return _cm.getNumberOfMicroEdges(); }
+ unsigned fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, INTERP_KERNEL::NormalizedCellType& typeOfSon) const { return _cm.fillMicroEdgeNodalConnectivity(sonId,nodalConn,sonNodalConn,typeOfSon); }
+ static const int DELTA=2;
+private:
+ const INTERP_KERNEL::CellModel& _cm;
+};
+
/// @endcond
/*!
return buildDescendingConnectivityGen<MinusTwoSonsGenerator>(desc,descIndx,revDesc,revDescIndx,MEDCouplingFastNbrer);
}
+/*!
+ * This method computes the micro edges constituting each cell in \a this. Micro edge is an edge for non quadratic cells. Micro edge is an half edge for quadratic cells.
+ * This method works for both meshes with mesh dimenstion equal to 2 or 3. Dynamical cells are not supported (polygons, polyhedrons...)
+ *
+ * \sa explode3DMeshTo1D, buildDescendingConnectiviy
+ */
+MEDCouplingUMesh *MEDCouplingUMesh::explodeMeshIntoMicroEdges(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const
+{
+ checkFullyDefined();
+ switch(getMeshDimension())
+ {
+ case 2:
+ return buildDescendingConnectivityGen<MicroEdgesGenerator2D>(desc,descIndx,revDesc,revDescIndx,MEDCouplingFastNbrer);
+ case 3:
+ return buildDescendingConnectivityGen<MicroEdgesGenerator2D>(desc,descIndx,revDesc,revDescIndx,MEDCouplingFastNbrer);
+ default:
+ throw INTERP_KERNEL::Exception("MEDCouplingUMesh::explodeMeshIntoMicroEdges : Only 2D and 3D supported !");
+ }
+}
+
/*!
* Creates a new MEDCouplingUMesh containing cells, of dimension one less than \a
* this->getMeshDimension(), that bound cells of \a this mesh. In
{
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());
}
}
}
{
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<nbOfCells;cellId++)
if(std::count(c+ci[i]+1,c+ci[i+1],-1)!=0)
{
std::ostringstream oss; oss << "MEDCouplingUMesh::convertExtrudedPolyhedra : cell # " << i << " is a polhedron BUT it has NOT exactly 1 face !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ throw INTERP_KERNEL::Exception(oss.str());
}
std::size_t n2=std::distance(c+ci[i]+1,c+ci[i+1]);
if(n2%2!=0)
{
std::ostringstream oss; oss << "MEDCouplingUMesh::convertExtrudedPolyhedra : cell # " << i << " is a polhedron with 1 face but there is a mismatch of number of nodes in face should be even !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ throw INTERP_KERNEL::Exception(oss.str());
}
int n1=(int)(n2/2);
newci[i+1]=7*n1+2+newci[i];//6*n1 (nodal length) + n1+2 (number of faces) - 1 (number of '-1' separator is equal to number of faces -1) + 1 (for cell type)
* \warning Cells of the result mesh are \b not sorted by geometric type, hence,
* to write this mesh to the MED file, its cells must be sorted using
* sortCellsInMEDFileFrmt().
+ * \warning Cells (and most notably polyhedrons) must be correctly oriented for this to work
+ * properly. See orientCorrectlyPolyhedrons() and arePolyhedronsNotCorrectlyOriented().
* \return \c true if at least one cell has been converted, \c false else. In the
* last case the nodal connectivity remains unchanged.
* \throw If the coordinates array is not set.
DataArrayInt *MEDCouplingUMesh::computeFetchedNodeIds() const
{
checkConnectivityFullyDefined();
- int nbOfCells=getNumberOfCells();
- const int *connIndex=_nodal_connec_index->getConstPointer();
- const int *conn=_nodal_connec->getConstPointer();
- const int *maxEltPt=std::max_element(_nodal_connec->begin(),_nodal_connec->end());
- int maxElt=maxEltPt==_nodal_connec->end()?0:std::abs(*maxEltPt)+1;
+ const int *maxEltPt(std::max_element(_nodal_connec->begin(),_nodal_connec->end()));
+ int maxElt(maxEltPt==_nodal_connec->end()?0:std::abs(*maxEltPt)+1);
std::vector<bool> retS(maxElt,false);
- for(int i=0;i<nbOfCells;i++)
- for(int j=connIndex[i]+1;j<connIndex[i+1];j++)
- if(conn[j]>=0)
- retS[conn[j]]=true;
- int sz=0;
- for(int i=0;i<maxElt;i++)
- if(retS[i])
- sz++;
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc(sz,1);
- int *retPtr=ret->getPointer();
- for(int i=0;i<maxElt;i++)
- if(retS[i])
- *retPtr++=i;
- return ret;
+ computeNodeIdsAlg(retS);
+ return DataArrayInt::BuildListOfSwitchedOn(retS);
}
/*!
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());
}
}
}
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);
/*!
* Checks if \a this mesh includes all cells of an \a other mesh, and returns an array
* giving for each cell of the \a other an id of a cell in \a this mesh. A value larger
- * than \a other->getNumberOfCells() in the returned array means that there is no
+ * than \a this->getNumberOfCells() in the returned array means that there is no
* corresponding cell in \a this mesh.
* It is expected that \a this and \a other meshes share the same node coordinates
* array, if it is not so an exception is thrown.
std::ostringstream oss; oss << "MEDCouplingUMesh::areCellsIncludedIn : only following policies are possible : ";
std::copy(possibleCompType,possibleCompType+sizeof(possibleCompType)/sizeof(int),std::ostream_iterator<int>(oss," "));
oss << " !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ throw INTERP_KERNEL::Exception(oss.str());
}
MCAuto<DataArrayInt> o2n=mesh->zipConnectivityTraducer(compType,nbOfCells);
arr=o2n->subArray(nbOfCells);
{
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;
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)
{
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;
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)
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());
}
}
}
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());
}
}
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<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(newConnIPtr[0],1);
{
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));
MCAuto<DataArrayDouble> coo=_coords->deepCopy();
double normm2(sqrt(vec2[0]*vec2[0]+vec2[1]*vec2[1]+vec2[2]*vec2[2]));
if(normm2/normm>1e-6)
- MEDCouplingPointSet::Rotate3DAlg(origin,vec2,angle,coo->getNumberOfTuples(),coo->getPointer());
+ DataArrayDouble::Rotate3DAlg(origin,vec2,angle,coo->getNumberOfTuples(),coo->getPointer(),coo->getPointer());
MCAuto<MEDCouplingUMesh> mw=clone(false);//false -> shallow copy
mw->setCoords(coo);
mw->getBoundingBox(bbox);
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<DataArrayDouble> pts=DataArrayDouble::New(); pts->useArray(ptBg,false,C_DEALLOC,1,spaceDim);
MCAuto<DataArrayDouble> ret0=distanceToPoints(pts,ret1);
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();
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]);
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
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());
}
}
}
}
/*!
- * This method aggregate the bbox of each cell and put it into bbox parameter.
+ * This method aggregate the bbox of each cell and put it into bbox parameter (xmin,xmax,ymin,ymax,zmin,zmax).
*
* \param [in] arcDetEps - a parameter specifying in case of 2D quadratic polygon cell the detection limit between linear and arc circle. (By default 1e-12)
* For all other cases this input parameter is ignored.
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();
{
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;
{
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());
}
}
}
{
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;
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;
//
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();
{
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;
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();
{
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<DataArrayInt> idsTokeep=DataArrayInt::New(); idsTokeep->alloc(sz+(int)std::distance(idsPerGeoTypeBg,idsPerGeoTypeEnd),1);
int *idsPtr=idsTokeep->getPointer();
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;
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
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())
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());
}
}
}
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];
* \throw If \a a[ *i* ]->getMeshDimension() < 0.
* \throw If the meshes in \a a are of different dimension (getMeshDimension()).
*/
-MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshes(std::vector<const MEDCouplingUMesh *>& a)
+MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshes(const std::vector<const MEDCouplingUMesh *>& a)
{
std::size_t sz=a.size();
if(sz==0)
if(!a[ii])
{
std::ostringstream oss; oss << "MEDCouplingUMesh::MergeUMeshes : item #" << ii << " in input array of size "<< sz << " is empty !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ throw INTERP_KERNEL::Exception(oss.str());
}
std::vector< MCAuto<MEDCouplingUMesh> > bb(sz);
std::vector< const MEDCouplingUMesh * > aa(sz);
/// @cond INTERNAL
-MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(std::vector<const MEDCouplingUMesh *>& a)
+MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(const std::vector<const MEDCouplingUMesh *>& a)
{
if(a.empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::MergeUMeshes : input array must be NON EMPTY !");
if(!meshes[ii])
{
std::ostringstream oss; oss << "MEDCouplingUMesh::MergeUMeshesOnSameCoords : item #" << ii << " in input array of size "<< meshes.size() << " is empty !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ throw INTERP_KERNEL::Exception(oss.str());
}
const DataArrayDouble *coords=meshes.front()->getCoords();
int meshDim=meshes.front()->getMeshDimension();
{
std::ostringstream oss; oss << " MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords : Item #" << std::distance(meshes.begin(),it) << " inside the vector of length " << meshes.size();
oss << " has no coordinate array defined !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ throw INTERP_KERNEL::Exception(oss.str());
}
}
else
{
std::ostringstream oss; oss << " MEDCouplingUMesh::PutUMeshesOnSameAggregatedCoords : Item #" << std::distance(meshes.begin(),it) << " inside the vector of length " << meshes.size();
oss << " is null !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ throw INTERP_KERNEL::Exception(oss.str());
}
}
MCAuto<DataArrayDouble> res=DataArrayDouble::Aggregate(coords);
else
{
std::ostringstream oss; oss << "MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords : In input vector of unstructured meshes of size " << meshes.size() << " the element #" << std::distance(meshes.begin(),it) << " is null !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ throw INTERP_KERNEL::Exception(oss.str());
}
}
if(s.size()!=1)
{
std::ostringstream oss; oss << "MEDCouplingUMesh::MergeNodesOnUMeshesSharingSameCoords : In input vector of unstructured meshes of size " << meshes.size() << ", it appears that they do not share the same instance of DataArrayDouble for coordiantes ! tryToShareSameCoordsPermute method can help to reach that !";
- throw INTERP_KERNEL::Exception(oss.str().c_str());
+ throw INTERP_KERNEL::Exception(oss.str());
}
const DataArrayDouble *coo=*(s.begin());
if(!coo)
std::pair<int,int> p1(bgFace[j],bgFace[(j+1)%nbOfEdgesInFace]);
std::pair<int,int> 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<int,int> >::iterator it=std::find(edgesOK.begin(),edgesOK.end(),p2);
if(it!=edgesOK.end())
{
int nbOfCells=getNumberOfCells();
if(nbOfCells<=0)
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::writeVTK : the unstructured mesh has no cells !");
- static const int PARAMEDMEM2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]={1,3,21,5,9,7,22,34,23,28,-1,-1,-1,-1,10,14,13,-1,12,-1,24,-1,16,27,-1,26,-1,29,-1,-1,25,42,36,4};
ofs << " <" << getVTKDataSetType() << ">\n";
ofs << " <Piece NumberOfPoints=\"" << getNumberOfNodes() << "\" NumberOfCells=\"" << nbOfCells << "\">\n";
ofs << " <PointData>\n" << pointData << std::endl;
w4=std::copy(c.begin(),c.end(),w4);
}
}
- types->transformWithIndArr(PARAMEDMEM2VTKTYPETRADUCER,PARAMEDMEM2VTKTYPETRADUCER+INTERP_KERNEL::NORM_MAXTYPE+1);
+ types->transformWithIndArr(MEDCOUPLING2VTKTYPETRADUCER,MEDCOUPLING2VTKTYPETRADUCER+INTERP_KERNEL::NORM_MAXTYPE+1);
types->writeVTK(ofs,8,"UInt8","types",byteData);
offsets->writeVTK(ofs,8,"Int32","offsets",byteData);
if(szFaceOffsets!=0)
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<int,INTERP_KERNEL::Node *>::const_iterator it=mappRev.begin();it!=mappRev.end();it++)
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;
{
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);
{
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();
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;
{
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);
{
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();
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();
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());
}
}
}
if(*seedElt>=0 && *seedElt<nbOfTuples)
{ fetched[*seedElt]=true; fetched2[*seedElt]=true; }
else
- { std::ostringstream oss; oss << "MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg : At pos #" << i << " of seeds value is " << *seedElt << "! Should be in [0," << nbOfTuples << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); }
+ { std::ostringstream oss; oss << "MEDCouplingUMesh::ComputeSpreadZoneGraduallyFromSeedAlg : At pos #" << i << " of seeds value is " << *seedElt << "! Should be in [0," << nbOfTuples << ") !"; throw INTERP_KERNEL::Exception(oss.str()); }
}
const int *arrInPtr=arrIn->getConstPointer();
const int *arrIndxPtr=arrIndxIn->getConstPointer();
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();
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());
}
}
}