-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
return INTERP_KERNEL::NORM_QUAD4;
case 1:
return INTERP_KERNEL::NORM_SEG2;
+ case 0:
+ return INTERP_KERNEL::NORM_POINT1;
default:
throw INTERP_KERNEL::Exception("Unexpected dimension for MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension !");
}
int ns[3];
getNodeGridStructure(ns);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(Build1GTNodalConnectivity(ns,ns+meshDim));
- MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName().c_str(),GetGeoTypeGivenMeshDimension(meshDim)));
+ MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim)));
ret->setNodalConnectivity(conn); ret->setCoords(coords);
return ret.retn();
}
void MEDCouplingStructuredMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const
{
std::vector<int> ngs(getNodeGridStructure());
- int dim(getMeshDimension());
+ int dim(getSpaceDimension());
switch(dim)
{
case 1:
if(nbNodes==0)
{ revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; }
if(nbNodes==1)
- { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); revNodalIndx->setIJ(1,0,0); return ; }
+ { revNodal->alloc(1,1); revNodal->setIJ(0,0,0); revNodalIndx->setIJ(0,0,0); revNodalIndx->setIJ(1,0,1); return ; }
revNodal->alloc(2*(nbNodes-1),1);
int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer());
*rni++=0; *rni=1; *rn++=0;
std::size_t dim=std::distance(nodeStBg,nodeStEnd);
switch(dim)
{
+ case 0:
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New());
+ conn->alloc(1,1); conn->setIJ(0,0,0);
+ return conn.retn();
+ }
case 1:
return Build1GTNodalConnectivity1D(nodeStBg);
case 2:
case 3:
return Build1GTNodalConnectivity3D(nodeStBg);
default:
- throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::Build1GTNodalConnectivity : only dimension in [1,2,3] supported !");
+ throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::Build1GTNodalConnectivity : only dimension in [0,1,2,3] supported !");
}
}
{
int tmp[3]={i,j,k};
int tmp2[3];
- int meshDim=getMeshDimension();
+ int meshDim(getMeshDimension());
getSplitCellValues(tmp2);
std::transform(tmp,tmp+meshDim,tmp2,tmp,std::multiplies<int>());
return std::accumulate(tmp,tmp+meshDim,0);
{
int tmp[3]={i,j,k};
int tmp2[3];
- int meshDim=getMeshDimension();
+ int spaceDim(getSpaceDimension());
getSplitNodeValues(tmp2);
- std::transform(tmp,tmp+meshDim,tmp2,tmp,std::multiplies<int>());
- return std::accumulate(tmp,tmp+meshDim,0);
+ std::transform(tmp,tmp+spaceDim,tmp2,tmp,std::multiplies<int>());
+ return std::accumulate(tmp,tmp+spaceDim,0);
}
void MEDCouplingStructuredMesh::GetPosFromId(int nodeId, int meshDim, const int *split, int *res)