+/*!
+ * Given points in \a ptsInRefCoo in the reference coordinates of \a this (in _ref_coord attribute)
+ * this method computes their coordinates in real world for each cells in \a mesh.
+ * So the returned array will contain nbCells* \a ptsInRefCoo->getNumberOfTuples() tuples and the number of component
+ * will be equal to the dimension of \a this.
+ *
+ * This method ignores Gauss points in \a this and only those in \a ptsInRefCoo are considered here.
+ */
+MCAuto<DataArrayDouble> MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell(const DataArrayDouble *ptsInRefCoo, const MEDCouplingUMesh *mesh) const
+{
+ if(!ptsInRefCoo || !mesh)
+ throw INTERP_KERNEL::Exception("MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell : null pointer !");
+ ptsInRefCoo->checkAllocated();
+ mesh->checkConsistencyLight();
+ //
+ int nbCells(mesh->getNumberOfCells());
+ const double *coords(mesh->getCoords()->begin());
+ const int *connI(mesh->getNodalConnectivityIndex()->begin()),*conn(mesh->getNodalConnectivity()->begin());
+ //
+ int nbPts(ptsInRefCoo->getNumberOfTuples());
+ INTERP_KERNEL::NormalizedCellType typ(getType());
+ int dim(INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension()),outDim(mesh->getSpaceDimension());
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
+ ret->alloc(nbPts*nbCells,outDim);
+ double *retPtr(ret->getPointer());
+ 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*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());
+}
+