Back to index

salome-med  6.5.0
Public Member Functions | Static Public Member Functions | Protected Attributes
ParaMEDMEM::MEDFileMeshL2 Class Reference

#include <MEDFileMeshLL.hxx>

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

List of all members.

Public Member Functions

 MEDFileMeshL2 ()
const char * getName () const
const char * getDescription () const
const char * getTimeUnit () const
int getIteration () const
int getOrder () const
double getTime ()
std::vector< std::string > getAxisInfoOnMesh (med_idt fid, int mId, const char *mName, ParaMEDMEM::MEDCouplingMeshType &meshType, int &nstep, int &Mdim) throw (INTERP_KERNEL::Exception)
def incrRef
def getHiddenCppPointer

Static Public Member Functions

static int GetMeshIdFromName (med_idt fid, const char *mName, ParaMEDMEM::MEDCouplingMeshType &meshType, int &dt, int &it, std::string &dtunit1) throw (INTERP_KERNEL::Exception)
static double CheckMeshTimeStep (med_idt fid, const char *mname, int nstep, int dt, int it) throw (INTERP_KERNEL::Exception)
static void ReadFamiliesAndGrps (med_idt fid, const char *mname, std::map< std::string, int > &fams, std::map< std::string, std::vector< std::string > > &grps)
static void WriteFamiliesAndGrps (med_idt fid, const char *mname, const std::map< std::string, int > &fams, const std::map< std::string, std::vector< std::string > > &grps, int tooLongStrPol)

Protected Attributes

MEDFileString _name
MEDFileString _description
MEDFileString _dt_unit
int _iteration
int _order
double _time

Detailed Description

Definition at line 36 of file MEDFileMeshLL.hxx.


Constructor & Destructor Documentation

Definition at line 37 of file MEDFileMeshLL.cxx.

                            :_name(MED_NAME_SIZE),_description(MED_COMMENT_SIZE),_dt_unit(MED_LNAME_SIZE)
{
}

Member Function Documentation

double MEDFileMeshL2::CheckMeshTimeStep ( med_idt  fid,
const char *  mname,
int  nstep,
int  dt,
int  it 
) throw (INTERP_KERNEL::Exception) [static]

Definition at line 95 of file MEDFileMeshLL.cxx.

{
  bool found=false;
  med_int numdt,numit;
  med_float dtt;
  std::vector< std::pair<int,int> > p(nstep);
  for(int i=0;i<nstep;i++)
    {
      MEDmeshComputationStepInfo(fid,mName,i+1,&numdt,&numit,&dtt);
      p[i]=std::make_pair<int,int>(numdt,numit);
      found=(numdt==dt) && (numit==numit);
    }
  if(!found)
    {
      std::ostringstream oss; oss << "No such iteration=" << dt << ",order=" << it << " numbers found for mesh '" << mName << "' ! ";
      oss << "Possibilities are : ";
      for(int i=0;i<nstep;i++)
        oss << "(" << p[i].first << "," << p[i].second << "), ";
      throw INTERP_KERNEL::Exception(oss.str().c_str());
    }
  return dtt;
}

Here is the caller graph for this function:

std::vector< std::string > MEDFileMeshL2::getAxisInfoOnMesh ( med_idt  fid,
int  mId,
const char *  mName,
ParaMEDMEM::MEDCouplingMeshType meshType,
int &  nstep,
int &  Mdim 
) throw (INTERP_KERNEL::Exception)

Definition at line 118 of file MEDFileMeshLL.cxx.

{
  med_mesh_type type_maillage;
  med_int spaceDim;
  med_sorting_type stype;
  med_axis_type axistype;
  int naxis=MEDmeshnAxis(fid,mId);
  INTERP_KERNEL::AutoPtr<char> nameTmp=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
  INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
  INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
  if(MEDmeshInfo(fid,mId,nameTmp,&spaceDim,&Mdim,&type_maillage,_description.getPointer(),_dt_unit.getPointer(),
                 &stype,&nstep,&axistype,axisname,axisunit)!=0)
    throw INTERP_KERNEL::Exception("A problem has been detected when trying to get info on mesh !");
  switch(type_maillage)
    {
    case MED_UNSTRUCTURED_MESH:
      meshType=UNSTRUCTURED;
      break;
    case MED_STRUCTURED_MESH:
      meshType=CARTESIAN;
      break;
    default:
      throw INTERP_KERNEL::Exception("MEDFileUMeshL2::getMeshIdFromName : unrecognized mesh type !");
    }
  //
  std::vector<std::string> infosOnComp(naxis);
  for(int i=0;i<naxis;i++)
    {
      std::string info=MEDLoaderBase::buildUnionUnit(((char *)axisname)+i*MED_SNAME_SIZE,MED_SNAME_SIZE,((char *)axisunit)+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
      infosOnComp[i]=info;
    }
  return infosOnComp;
}

Here is the caller graph for this function:

const char* ParaMEDMEM::MEDFileMeshL2::getDescription ( ) const [inline]

Definition at line 41 of file MEDFileMeshLL.hxx.

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 43 of file MEDFileMeshLL.hxx.

{ return _iteration; }
int MEDFileMeshL2::GetMeshIdFromName ( med_idt  fid,
const char *  mName,
ParaMEDMEM::MEDCouplingMeshType meshType,
int &  dt,
int &  it,
std::string &  dtunit1 
) throw (INTERP_KERNEL::Exception) [static]

Definition at line 41 of file MEDFileMeshLL.cxx.

{
  med_mesh_type type_maillage;
  char maillage_description[MED_COMMENT_SIZE+1];
  char dtunit[MED_LNAME_SIZE+1];
  med_int spaceDim,dim;
  char nommaa[MED_NAME_SIZE+1];
  med_int n=MEDnMesh(fid);
  bool found=false;
  int ret=-1;
  med_sorting_type stype;
  std::vector<std::string> ms;
  int nstep;
  med_axis_type axistype;
  for(int i=0;i<n && !found;i++)
    {
      int naxis=MEDmeshnAxis(fid,i+1);
      INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
      INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
      MEDmeshInfo(fid,i+1,nommaa,&spaceDim,&dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit);
      dtunit1=MEDLoaderBase::buildStringFromFortran(dtunit,sizeof(dtunit));
      std::string cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa));
      ms.push_back(cur);
      if(cur==mname)
        {
          found=true;
          ret=i+1;
        }
    }
  if(!found)
    {
      std::ostringstream oss;
      oss << "No such meshname (" << mname <<  ") in file ! Must be in :";
      std::copy(ms.begin(),ms.end(),std::ostream_iterator<std::string>(oss,", "));
      throw INTERP_KERNEL::Exception(oss.str().c_str());
    }
  switch(type_maillage)
    {
    case MED_UNSTRUCTURED_MESH:
      meshType=UNSTRUCTURED;
      break;
    case MED_STRUCTURED_MESH:
      meshType=CARTESIAN;
      break;
    default:
      throw INTERP_KERNEL::Exception("MEDFileUMeshL2::getMeshIdFromName : unrecognized mesh type !");
    }
  med_int numdt,numit;
  med_float dtt;
  MEDmeshComputationStepInfo(fid,mname,1,&numdt,&numit,&dtt);
  dt=numdt; it=numit;
  return ret;
}
const char* ParaMEDMEM::MEDFileMeshL2::getName ( ) const [inline]

Definition at line 40 of file MEDFileMeshLL.hxx.

{ return _name.getReprForWrite(); }

Here is the call graph for this function:

int ParaMEDMEM::MEDFileMeshL2::getOrder ( ) const [inline]

Definition at line 44 of file MEDFileMeshLL.hxx.

{ return _order; }

Definition at line 45 of file MEDFileMeshLL.hxx.

{ return _time; }
const char* ParaMEDMEM::MEDFileMeshL2::getTimeUnit ( ) const [inline]

Definition at line 42 of file MEDFileMeshLL.hxx.

{ return _dt_unit.getReprForWrite(); }

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)

void MEDFileMeshL2::ReadFamiliesAndGrps ( med_idt  fid,
const char *  mname,
std::map< std::string, int > &  fams,
std::map< std::string, std::vector< std::string > > &  grps 
) [static]

Definition at line 152 of file MEDFileMeshLL.cxx.

{
  char nomfam[MED_NAME_SIZE+1];
  med_int numfam;
  int nfam=MEDnFamily(fid,meshName);
  for(int i=0;i<nfam;i++)
    {
      int ngro=MEDnFamilyGroup(fid,meshName,i+1);
      med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
      INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
      INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
      INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
      INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
      MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
      std::string famName=MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE);
      fams[famName]=numfam;
      for(int j=0;j<ngro;j++)
        {
          std::string groupname=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
          grps[groupname].push_back(famName);
        }
    }
}
void MEDFileMeshL2::WriteFamiliesAndGrps ( med_idt  fid,
const char *  mname,
const std::map< std::string, int > &  fams,
const std::map< std::string, std::vector< std::string > > &  grps,
int  tooLongStrPol 
) [static]

Definition at line 176 of file MEDFileMeshLL.cxx.

{
  for(std::map<std::string,int>::const_iterator it=fams.begin();it!=fams.end();it++)
    {
      std::vector<std::string> grpsOfFam;
      for(std::map<std::string, std::vector<std::string> >::const_iterator it1=grps.begin();it1!=grps.end();it1++)
        {
          if(std::find((*it1).second.begin(),(*it1).second.end(),(*it).first)!=(*it1).second.end())
            grpsOfFam.push_back((*it1).first);
        }
      int ngro=grpsOfFam.size();
      INTERP_KERNEL::AutoPtr<char> groName=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE*ngro);
      int i=0;
      for(std::vector<std::string>::const_iterator it2=grpsOfFam.begin();it2!=grpsOfFam.end();it2++,i++)
        MEDLoaderBase::safeStrCpy2((*it2).c_str(),MED_LNAME_SIZE-1,groName+i*MED_LNAME_SIZE,tooLongStrPol);
      INTERP_KERNEL::AutoPtr<char> famName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
      MEDLoaderBase::safeStrCpy((*it).first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol);
      int ret=MEDfamilyCr(fid,mname,famName,(*it).second,ngro,groName);
      ret++;
    }
}

Member Data Documentation

Definition at line 53 of file MEDFileMeshLL.hxx.

Definition at line 54 of file MEDFileMeshLL.hxx.

Definition at line 55 of file MEDFileMeshLL.hxx.

Definition at line 52 of file MEDFileMeshLL.hxx.

Definition at line 56 of file MEDFileMeshLL.hxx.

Definition at line 57 of file MEDFileMeshLL.hxx.


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