-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2013 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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// Author : Anthony Geay (CEA/DEN)
#include "MEDCouplingExtrudedMesh.hxx"
#include "MEDCouplingUMesh.hxx"
return EXTRUDED;
}
+std::size_t MEDCouplingExtrudedMesh::getHeapMemorySize() const
+{
+ std::size_t ret=0;
+ if(_mesh2D)
+ ret+=_mesh2D->getHeapMemorySize();
+ if(_mesh1D)
+ ret+=_mesh1D->getHeapMemorySize();
+ if(_mesh3D_ids)
+ ret+=_mesh3D_ids->getHeapMemorySize();
+ return MEDCouplingMesh::getHeapMemorySize()+ret;
+}
+
/*!
* This method copyies all tiny strings from other (name and components name).
* @throw if other and this have not same mesh type.
if(_mesh2D!=0)
_mesh2D->incrRef();
computeExtrusion(mesh3D);
- setName(mesh3D->getName());
+ setName(mesh3D->getName().c_str());
}
catch(INTERP_KERNEL::Exception& e)
{
return ret;
}
+DataArrayInt *MEDCouplingExtrudedMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
+{
+ const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
+ INTERP_KERNEL::NormalizedCellType revExtTyp=cm.getReverseExtrudedType();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ if(revExtTyp==INTERP_KERNEL::NORM_ERROR)
+ {
+ ret->alloc(0,1);
+ return ret.retn();
+ }
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=_mesh2D->giveCellsWithType(revExtTyp);
+ int nbOfLevs=_mesh1D->getNumberOfCells();
+ int nbOfCells2D=_mesh2D->getNumberOfCells();
+ int nbOfTuples=tmp->getNumberOfTuples();
+ ret->alloc(nbOfLevs*nbOfTuples,1);
+ int *pt=ret->getPointer();
+ for(int i=0;i<nbOfLevs;i++,pt+=nbOfTuples)
+ std::transform(tmp->begin(),tmp->end(),pt,std::bind2nd(std::plus<double>(),i*nbOfCells2D));
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=ret->renumberR(_mesh3D_ids->begin());
+ ret2->sort();
+ return ret2.retn();
+}
+
+DataArrayInt *MEDCouplingExtrudedMesh::computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception)
+{
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2D=_mesh2D->computeNbOfNodesPerCell();
+ int nbOfLevs=_mesh1D->getNumberOfCells();
+ int nbOfCells2D=_mesh2D->getNumberOfCells();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
+ int *pt=ret3D->getPointer();
+ for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
+ std::copy(ret2D->begin(),ret2D->end(),pt);
+ ret3D->applyLin(2,0,0);
+ return ret3D->renumberR(_mesh3D_ids->begin());
+}
+
+DataArrayInt *MEDCouplingExtrudedMesh::computeNbOfFacesPerCell() const throw(INTERP_KERNEL::Exception)
+{
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2D=_mesh2D->computeNbOfNodesPerCell();
+ int nbOfLevs=_mesh1D->getNumberOfCells();
+ int nbOfCells2D=_mesh2D->getNumberOfCells();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
+ int *pt=ret3D->getPointer();
+ for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
+ std::copy(ret2D->begin(),ret2D->end(),pt);
+ ret3D->applyLin(2,2,0);
+ return ret3D->renumberR(_mesh3D_ids->begin());
+}
+
+DataArrayInt *MEDCouplingExtrudedMesh::computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception)
+{
+ return computeNbOfNodesPerCell();
+}
+
int MEDCouplingExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
{
int ret=0;
MEDCouplingUMesh *ret=_mesh2D->buildExtrudedMesh(_mesh1D,0);
const int *renum=_mesh3D_ids->getConstPointer();
ret->renumberCells(renum,false);
- ret->setName(getName());
+ ret->setName(getName().c_str());
return ret;
}
int nbOf1DCells=_mesh1D->getNumberOfCells();
int nbOf3DCells=nbOf2DCells*nbOf1DCells;
const int *renum=_mesh3D_ids->getConstPointer();
- MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,NO_TIME);
+ MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
ret->setMesh(this);
+ ret->synchronizeTimeWithMesh();
DataArrayDouble *da=DataArrayDouble::New();
da->alloc(nbOf3DCells,1);
double *retPtr=da->getPointer();
DataArrayDouble *MEDCouplingExtrudedMesh::getBarycenterAndOwner() const
{
- //not yet implemented
- return 0;
+ throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::getBarycenterAndOwner : not yet implemented !");
+}
+
+DataArrayDouble *MEDCouplingExtrudedMesh::computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception)
+{
+ throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::computeIsoBarycenterOfNodesPerCell: not yet implemented !");
}
void MEDCouplingExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D) throw(INTERP_KERNEL::Exception)
m->writeVTKLL(ofs,cellData,pointData);
}
+void MEDCouplingExtrudedMesh::reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+ stream << "MEDCouplingExtrudedMesh C++ instance at " << this << ". Name : \"" << getName() << "\".";
+}
+
std::string MEDCouplingExtrudedMesh::getVTKDataSetType() const throw(INTERP_KERNEL::Exception)
{
return _mesh2D->getVTKDataSetType();