#include "MEDCouplingGaussLocalization.hxx"
#include "InterpKernelGaussCoords.hxx"
+#include "MEDCoupling1GTUMesh.hxx"
#include "MEDCouplingUMesh.hxx"
#include "CellModel.hxx"
//
int nbPts(ptsInRefCoo->getNumberOfTuples());
INTERP_KERNEL::NormalizedCellType typ(getType());
- int dim(INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension());
+ int dim(INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension()),outDim(mesh->getSpaceDimension());
MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
- ret->alloc(nbPts*nbCells,dim);
+ ret->alloc(nbPts*nbCells,outDim);
double *retPtr(ret->getPointer());
- if(dim!=ptsInRefCoo->getNumberOfComponents())
+ if(dim!=(int)ptsInRefCoo->getNumberOfComponents())
throw INTERP_KERNEL::Exception("MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell : number of components of input coo is not equal to dim of element !");
const std::vector<double>& wg(getWeights());
INTERP_KERNEL::GaussCoords calculator;
calculator.addGaussInfo(typ,dim, ptsInRefCoo->begin(),nbPts,&_ref_coord[0],getNumberOfPtsInRefCell());
//
- for(int i=0;i<nbCells;i++,retPtr+=nbPts*dim)
- calculator.calculateCoords(getType(),coords,dim,conn+connI[i]+1,retPtr);
+ for(int i=0;i<nbCells;i++,retPtr+=nbPts*outDim)
+ calculator.calculateCoords(getType(),coords,outDim,conn+connI[i]+1,retPtr);
return ret;
}
+/*!
+ * This method returns an unstructured mesh that represents the reference cell.
+ */
+MCAuto<MEDCouplingUMesh> MEDCouplingGaussLocalization::buildRefCell() const
+{
+ MCAuto<DataArrayDouble> coo(DataArrayDouble::New());
+ const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getType()));
+ if(getDimension()!=(int)cm.getDimension())
+ throw INTERP_KERNEL::Exception("BuildRefCell : dimension mistmatch !");
+ coo->alloc(cm.getNumberOfNodes(),getDimension());
+ std::copy(_ref_coord.begin(),_ref_coord.end(),coo->getPointer());
+ MCAuto<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New("",getType()));
+ ret->setCoords(coo);
+ MCAuto<DataArrayInt> conn(DataArrayInt::New());
+ conn->alloc(cm.getNumberOfNodes(),1);
+ conn->iota();
+ ret->setNodalConnectivity(conn);
+ return MCAuto<MEDCouplingUMesh>(ret->buildUnstructured());
+}
+
/*!
* This method sets the comp_th component of ptIdInCell_th point coordinate of reference element of type this->_type.
* @throw if not 0<=ptIdInCell<nbOfNodePerCell or if not 0<=comp<dim