Back to index

salome-med  6.5.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
ParaMEDMEM::MEDFileUMeshSplitL1 Class Reference

#include <MEDFileMeshLL.hxx>

Inheritance diagram for ParaMEDMEM::MEDFileUMeshSplitL1:
Inheritance graph
[legend]
Collaboration diagram for ParaMEDMEM::MEDFileUMeshSplitL1:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MEDFileUMeshSplitL1 (const MEDFileUMeshL2 &l2, const char *mName, int id)
 MEDFileUMeshSplitL1 (MEDCouplingUMesh *m)
 MEDFileUMeshSplitL1 (MEDCouplingUMesh *m, bool newOrOld)
bool isEqual (const MEDFileUMeshSplitL1 *other, double eps, std::string &what) const
void clearNonDiscrAttributes () const
void synchronizeTinyInfo (const MEDFileMesh &master) const
void assignMesh (MEDCouplingUMesh *m, bool newOrOld) throw (INTERP_KERNEL::Exception)
bool empty () const
bool presenceOfOneFams (const std::vector< int > &ids) const
int getMeshDimension () const
void simpleRepr (std::ostream &oss) const
int getSize () const throw (INTERP_KERNEL::Exception)
MEDCouplingUMeshgetFamilyPart (const std::vector< int > &ids, bool renum) const
DataArrayIntgetFamilyPartArr (const std::vector< int > &ids, bool renum) const
MEDCouplingUMeshgetWholeMesh (bool renum) const
const DataArrayIntgetFamilyField () const
const DataArrayIntgetNumberField () const
const DataArrayIntgetRevNumberField () const
void eraseFamilyField ()
void setGroupsFromScratch (const std::vector< const MEDCouplingUMesh * > &ms, std::map< std::string, int > &familyIds, std::map< std::string, std::vector< std::string > > &groups) throw (INTERP_KERNEL::Exception)
 This method ignores _m and _m_by_types.
void write (med_idt fid, const char *mName, int mdim) const
void setFamilyArr (DataArrayInt *famArr)
void setRenumArr (DataArrayInt *renumArr)
void changeFamilyIdArr (int oldId, int newId) throw (INTERP_KERNEL::Exception)
def incrRef
def getHiddenCppPointer

Static Public Member Functions

static void ClearNonDiscrAttributes (const MEDCouplingMesh *tmp)
static std::vector< int > GetNewFamiliesNumber (int nb, const std::map< std::string, int > &families)
static void TraduceFamilyNumber (const std::vector< std::vector< int > > &fidsGrps, std::map< std::string, int > &familyIds, std::map< int, int > &famIdTrad, std::map< int, std::string > &newfams)
static DataArrayIntRenumber (const DataArrayInt *renum, const DataArrayInt *da)
static MEDCouplingUMeshRenumber2 (const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds)

Private Member Functions

MEDCouplingUMeshrenumIfNeeded (MEDCouplingUMesh *m, const int *cellIds) const
DataArrayIntrenumIfNeededArr (const DataArrayInt *da) const
void computeRevNum () const

Private Attributes

MEDCouplingAutoRefCountObjectPtr
< MEDCouplingUMesh
_m_by_types
MEDCouplingAutoRefCountObjectPtr
< DataArrayInt
_fam
MEDCouplingAutoRefCountObjectPtr
< DataArrayInt
_num
MEDCouplingAutoRefCountObjectPtr
< DataArrayInt
_rev_num
MEDFileUMeshPermCompute _m

Friends

class MEDFileUMeshPermCompute

Detailed Description

Definition at line 114 of file MEDFileMeshLL.hxx.


Constructor & Destructor Documentation

MEDFileUMeshSplitL1::MEDFileUMeshSplitL1 ( const MEDFileUMeshL2 l2,
const char *  mName,
int  id 
)

Definition at line 416 of file MEDFileMeshLL.cxx.

                                                                                           :_m(this)
{
  const std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >& v=l2.getLev(id);
  if(v.empty())
    return;
  int sz=v.size();
  std::vector<const MEDCouplingUMesh *> ms(sz);
  for(int i=0;i<sz;i++)
    {
      MEDCouplingUMesh *tmp=MEDCouplingUMesh::New("",v[i]->getDim());
      MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp2=l2.getCoords();
      tmp->setCoords(tmp2);
      tmp->setConnectivity(const_cast<DataArrayInt *>(v[i]->getNodal()),const_cast<DataArrayInt *>(v[i]->getNodalIndex()));
      ms[i]=tmp;
    }
  _m_by_types=MEDCouplingUMesh::MergeUMeshesOnSameCoords(ms);
  _m_by_types->setName(mName);
  if(l2.isFamDefinedOnLev(id))
    {
      int nbOfCells=_m_by_types->getNumberOfCells();
      _fam=DataArrayInt::New();
      _fam->alloc(nbOfCells,1);
      int *w=_fam->getPointer();
      for(int i=0;i<sz;i++)
        w=std::copy(v[i]->getFam()->getConstPointer(),v[i]->getFam()->getConstPointer()+v[i]->getFam()->getNumberOfTuples(),w);
    }
  if(l2.isNumDefinedOnLev(id))
    {
      int nbOfCells=_m_by_types->getNumberOfCells();
      _num=DataArrayInt::New();
      _num->alloc(nbOfCells,1);
      int *w=_num->getPointer();
      for(int i=0;i<sz;i++)
        w=std::copy(v[i]->getNum()->getConstPointer(),v[i]->getNum()->getConstPointer()+v[i]->getNum()->getNumberOfTuples(),w);
      computeRevNum();
    }
  for(int i=0;i<sz;i++)
    (const_cast<MEDCouplingUMesh *>(ms[i]))->decrRef();//const cast under control to avoid a copy of array
}

Here is the call graph for this function:

Definition at line 456 of file MEDFileMeshLL.cxx.

                                                           :_m(this)
{
  assignMesh(m,true);
}

Here is the call graph for this function:

Definition at line 461 of file MEDFileMeshLL.cxx.

                                                                          :_m(this)
{
  assignMesh(m,newOrOld);
}

Here is the call graph for this function:


Member Function Documentation

void MEDFileUMeshSplitL1::assignMesh ( MEDCouplingUMesh m,
bool  newOrOld 
) throw (INTERP_KERNEL::Exception)

Definition at line 536 of file MEDFileMeshLL.cxx.

{
  if(newOrOld)
    {
      m->incrRef();
      _m=m;
      _m_by_types=(MEDCouplingUMesh *)m->deepCpy();
      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=_m_by_types->getRenumArrForConsecutiveCellTypesSpec(typmai2,typmai2+MED_N_CELL_FIXED_GEO);
      if(!da->isIdentity())
        {
          _num=da->invertArrayO2N2N2O(m->getNumberOfCells());
          _m.updateTime();
          computeRevNum();
          _m_by_types->renumberCells(da->getConstPointer(),false);
        }
    }
  else
    {
      if(!m->checkConsecutiveCellTypesAndOrder(typmai2,typmai2+MED_N_CELL_FIXED_GEO))
        throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::assignMesh : the mode of mesh setting expects to follow the MED file numbering convention ! it is not the case !");
      m->incrRef();
      _m_by_types=m;
    }
  _fam=DataArrayInt::New();
  _fam->alloc(m->getNumberOfCells(),1);
  _fam->fillWithValue(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void MEDFileUMeshSplitL1::changeFamilyIdArr ( int  oldId,
int  newId 
) throw (INTERP_KERNEL::Exception)

Definition at line 695 of file MEDFileMeshLL.cxx.

{
  DataArrayInt *arr=_fam;
  if(arr)
    arr->changeValue(oldId,newId);
}

Here is the call graph for this function:

Definition at line 521 of file MEDFileMeshLL.cxx.

Here is the call graph for this function:

Definition at line 526 of file MEDFileMeshLL.cxx.

{
  if(!tmp)
    return ;
  (const_cast<MEDCouplingMesh *>(tmp))->setName("");
  (const_cast<MEDCouplingMesh *>(tmp))->setDescription("");
  (const_cast<MEDCouplingMesh *>(tmp))->setTime(0.,-1,-1);
  (const_cast<MEDCouplingMesh *>(tmp))->setTimeUnit("");
}

Here is the caller graph for this function:

void MEDFileUMeshSplitL1::computeRevNum ( ) const [private]

Definition at line 769 of file MEDFileMeshLL.cxx.

{
  int pos;
  int maxValue=_num->getMaxValue(pos);
  _rev_num=_num->invertArrayN2O2O2N(maxValue+1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 564 of file MEDFileMeshLL.cxx.

{
  return ((const MEDCouplingUMesh *)_m_by_types)==0;
}

Definition at line 644 of file MEDFileMeshLL.cxx.

Here is the call graph for this function:

Definition at line 629 of file MEDFileMeshLL.cxx.

{
  return _fam;
}
MEDCouplingUMesh * MEDFileUMeshSplitL1::getFamilyPart ( const std::vector< int > &  ids,
bool  renum 
) const

Definition at line 600 of file MEDFileMeshLL.cxx.

Here is the call graph for this function:

DataArrayInt * MEDFileUMeshSplitL1::getFamilyPartArr ( const std::vector< int > &  ids,
bool  renum 
) const

Definition at line 609 of file MEDFileMeshLL.cxx.

{
  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=_fam->getIdsEqualList(ids);
  if(renum)
    return renumIfNeededArr(da);
  da->incrRef();
  return da;
}

Here is the call graph for this function:

getHiddenCppPointer(self) -> string

1

Definition at line 345 of file ParaMEDMEM.py.

00345 
00346     def getHiddenCppPointer(self):
00347         """
00348         getHiddenCppPointer(self) -> string
00349 
00350         1
00351         """
00352         return _ParaMEDMEM.RefCountObject_getHiddenCppPointer(self)

Definition at line 577 of file MEDFileMeshLL.cxx.

Here is the call graph for this function:

std::vector< int > MEDFileUMeshSplitL1::GetNewFamiliesNumber ( int  nb,
const std::map< std::string, int > &  families 
) [static]

Definition at line 749 of file MEDFileMeshLL.cxx.

{
  int id=-1;
  for(std::map<std::string,int>::const_iterator it=families.begin();it!=families.end();it++)
    id=std::max(id,(*it).second);
  if(id==-1)
    id=0;
  std::vector<int> ret(nb);
  for(int i=1;i<=nb;i++)
    ret[i]=id+i;
  return ret;
}

Definition at line 634 of file MEDFileMeshLL.cxx.

{
  return _num;
}

Definition at line 639 of file MEDFileMeshLL.cxx.

{
  return _rev_num;
}
int MEDFileUMeshSplitL1::getSize ( ) const throw (INTERP_KERNEL::Exception)

Definition at line 593 of file MEDFileMeshLL.cxx.

{
  if((const MEDCouplingUMesh *)_m_by_types==0)
    throw INTERP_KERNEL::Exception("MEDFileUMeshSplitL1::getSize : no mesh specified at level !");
  return _m_by_types->getNumberOfCells();
}

Here is the call graph for this function:

Definition at line 618 of file MEDFileMeshLL.cxx.

{
  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tmp;
  if(renum)
    tmp=_m;
  else
    tmp=_m_by_types;
  tmp->incrRef();
  return tmp;
}

Here is the call graph for this function:

def ParaMEDMEM.RefCountObject.incrRef (   self) [inherited]
incrRef(self)

1

Definition at line 337 of file ParaMEDMEM.py.

00337 
00338     def incrRef(self):
00339         """
00340         incrRef(self)
00341 
00342         1
00343         """
00344         return _ParaMEDMEM.RefCountObject_incrRef(self)

bool MEDFileUMeshSplitL1::isEqual ( const MEDFileUMeshSplitL1 other,
double  eps,
std::string &  what 
) const

Definition at line 466 of file MEDFileMeshLL.cxx.

{
  const MEDCouplingUMesh *m1=_m_by_types;
  const MEDCouplingUMesh *m2=other->_m_by_types;
  if((m1==0 && m2!=0) || (m1!=0 && m2==0))
    {
      what="Presence of mesh in one sublevel and not in other!";
      return false;
    }
  if(m1)
    if(!m1->isEqual(m2,eps))
      {
        what="meshes at a sublevel are not deeply equal !";
        return false;
      }
  const DataArrayInt *d1=_fam;
  const DataArrayInt *d2=other->_fam;
  if((d1==0 && d2!=0) || (d1!=0 && d2==0))
    {
      what="Presence of family arr in one sublevel and not in other!";
      return false;
    }
  if(d1)
    if(!d1->isEqual(*d2))
      {
        what="family arr at a sublevel are not deeply equal !";
        return false;
      }
  d1=_num;
  d2=other->_num;
  if((d1==0 && d2!=0) || (d1!=0 && d2==0))
    {
      what="Presence of cell numbering arr in one sublevel and not in other!";
      return false;
    }
  if(d1)
    if(!d1->isEqual(*d2))
      {
        what="Numbering cell arr at a sublevel are not deeply equal !";
        return false;
      }
  return true;
}

Here is the call graph for this function:

bool MEDFileUMeshSplitL1::presenceOfOneFams ( const std::vector< int > &  ids) const

Definition at line 569 of file MEDFileMeshLL.cxx.

{
  const DataArrayInt *fam=_fam;
  if(!fam)
    return false;
  return fam->presenceOfValue(ids);
}

Here is the call graph for this function:

DataArrayInt * MEDFileUMeshSplitL1::Renumber ( const DataArrayInt renum,
const DataArrayInt da 
) [static]

Definition at line 734 of file MEDFileMeshLL.cxx.

{
  if((const DataArrayInt *)renum==0)
    {
      da->incrRef();
      return const_cast<DataArrayInt *>(da);
    }
  return renum->selectByTupleId(da->getConstPointer(),da->getConstPointer()+da->getNumberOfTuples());
}

Here is the call graph for this function:

Here is the caller graph for this function:

MEDCouplingUMesh * MEDFileUMeshSplitL1::Renumber2 ( const DataArrayInt renum,
MEDCouplingUMesh m,
const int *  cellIds 
) [static]

Definition at line 715 of file MEDFileMeshLL.cxx.

{
  if(renum==0)
    return m;
  if(cellIds==0)
    m->renumberCells(renum->getConstPointer(),true);
  else
    {
      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> locnum=renum->selectByTupleId(cellIds,cellIds+m->getNumberOfCells());
      m->renumberCells(locnum->getConstPointer(),true);
    }
  return m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

MEDCouplingUMesh * MEDFileUMeshSplitL1::renumIfNeeded ( MEDCouplingUMesh m,
const int *  cellIds 
) const [private]

Definition at line 729 of file MEDFileMeshLL.cxx.

{
  return Renumber2(_num,m,cellIds);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 744 of file MEDFileMeshLL.cxx.

{
  return Renumber(_num,da);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 702 of file MEDFileMeshLL.cxx.

{
  famArr->incrRef();
  _fam=famArr;
}

Here is the call graph for this function:

void MEDFileUMeshSplitL1::setGroupsFromScratch ( const std::vector< const MEDCouplingUMesh * > &  ms,
std::map< std::string, int > &  familyIds,
std::map< std::string, std::vector< std::string > > &  groups 
) throw (INTERP_KERNEL::Exception)

This method ignores _m and _m_by_types.

Definition at line 652 of file MEDFileMeshLL.cxx.

{
  int sz=ms.size();
  std::vector< DataArrayInt * > corr;
  _m=MEDCouplingUMesh::FuseUMeshesOnSameCoords(ms,0,corr);
  std::vector< std::vector<int> > fidsOfGroups;
  std::vector< const DataArrayInt * > corr2(corr.begin(),corr.end());
  _fam=DataArrayInt::MakePartition(corr2,((MEDCouplingUMesh *)_m)->getNumberOfCells(),fidsOfGroups);
  int nbOfCells=((MEDCouplingUMesh *)_m)->getNumberOfCells();
  std::map<int,std::string> newfams;
  std::map<int,int> famIdTrad;
  TraduceFamilyNumber(fidsOfGroups,familyIds,famIdTrad,newfams);
  for(int i=0;i<sz;i++)
    corr[i]->decrRef();
  int *w=_fam->getPointer();
  for(int i=0;i<nbOfCells;i++,w++)
    *w=famIdTrad[*w];
}

Here is the call graph for this function:

Definition at line 708 of file MEDFileMeshLL.cxx.

{
  renumArr->incrRef();
  _num=renumArr;
  computeRevNum();
}

Here is the call graph for this function:

void MEDFileUMeshSplitL1::simpleRepr ( std::ostream &  oss) const

Definition at line 582 of file MEDFileMeshLL.cxx.

{
  std::vector<int> code=_m_by_types->getDistributionOfTypes();
  int nbOfTypes=code.size()/3;
  for(int i=0;i<nbOfTypes;i++)
    {
      INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType) code[3*i];
      oss << "    - Number of cells with type " << INTERP_KERNEL::CellModel::GetCellModel(typ).getRepr() << " : " << code[3*i+1] << std::endl;
    }
}

Here is the call graph for this function:

void MEDFileUMeshSplitL1::synchronizeTinyInfo ( const MEDFileMesh master) const

Definition at line 510 of file MEDFileMeshLL.cxx.

{
  const MEDCouplingUMesh *tmp=_m_by_types;
  if(!tmp)
    return ;
  (const_cast<MEDCouplingUMesh *>(tmp))->setName(master.getName());
  (const_cast<MEDCouplingUMesh *>(tmp))->setDescription(master.getDescription());
  (const_cast<MEDCouplingUMesh *>(tmp))->setTime(master.getTimeValue(),master.getIteration(),master.getOrder());
  (const_cast<MEDCouplingUMesh *>(tmp))->setTimeUnit(master.getTimeUnit());
}

Here is the call graph for this function:

void MEDFileUMeshSplitL1::TraduceFamilyNumber ( const std::vector< std::vector< int > > &  fidsGrps,
std::map< std::string, int > &  familyIds,
std::map< int, int > &  famIdTrad,
std::map< int, std::string > &  newfams 
) [static]

Definition at line 762 of file MEDFileMeshLL.cxx.

{
  std::set<int> allfids;
  
}

Here is the caller graph for this function:

void MEDFileUMeshSplitL1::write ( med_idt  fid,
const char *  mName,
int  mdim 
) const

Definition at line 672 of file MEDFileMeshLL.cxx.

{
  std::vector<MEDCouplingUMesh *> ms=_m_by_types->splitByType();
  int start=0;
  for(std::vector<MEDCouplingUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++)
    {
      int nbCells=(*it)->getNumberOfCells();
      int end=start+nbCells;
      DataArrayInt *fam=0,*num=0;
      if((const DataArrayInt *)_fam)
        fam=_fam->substr(start,end);
      if((const DataArrayInt *)_num)
        num=_num->substr(start,end);
      MEDFileUMeshPerType::write(fid,mName,mdim,(*it),fam,num);
      if(fam)
        fam->decrRef();
      if(num)
        num->decrRef();
      (*it)->decrRef();
      start=end;
    }
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class MEDFileUMeshPermCompute [friend]

Definition at line 116 of file MEDFileMeshLL.hxx.


Member Data Documentation

Definition at line 157 of file MEDFileMeshLL.hxx.

Definition at line 160 of file MEDFileMeshLL.hxx.

Definition at line 156 of file MEDFileMeshLL.hxx.

Definition at line 158 of file MEDFileMeshLL.hxx.

Definition at line 159 of file MEDFileMeshLL.hxx.


The documentation for this class was generated from the following files: