Back to index

salome-med  6.5.0
Classes | Public Member Functions | Public Attributes
SauvUtilities::DoubleField Struct Reference

#include <SauvMedConvertor.hxx>

Collaboration diagram for SauvUtilities::DoubleField:
Collaboration graph
[legend]

List of all members.

Classes

struct  _Sub_data

Public Member Functions

 DoubleField (int nb_sub, int total_nb_comp)
std::vector< double > & addComponent (int nb_values)
 Return a vector ready to fill in.
bool hasCommonSupport () const
bool hasSameComponentsBySupport () const
 return true if all sub-components has same components and same nbGauss
bool isMultiTimeStamps () const
 Return true if each sub-component is a time stamp.
bool isMedCompatible () const
 True if the field can be converted into the med field.
ParaMEDMEM::TypeOfField getMedType (const int iSub=0) const
 Return type of MEDCouplingFieldDouble.
ParaMEDMEM::TypeOfTimeDiscretization getMedTimeDisc () const
 Return TypeOfTimeDiscretization.
int getNbTuples (const int iSub=0) const
 Return nb tuples to be used to allocate DataArrayDouble.
int getNbValuesPerElement (const int iSub=0) const
int getNbGauss (const int iSub=0) const
const GroupgetSupport (const int iSub=0) const
 Returns a supporting group.
int setValues (double *valPtr, const int iSub, const int elemShift=0) const
 Store values of a sub-component and return nb of elements in the iSub.

Public Attributes

TID _idInFile
std::string _name
std::string _description
std::vector< _Sub_data_sub
Group_group
std::vector< std::vector
< double > > 
_comp_values
ParaMEDMEM::MEDFileFieldMultiTS_curMedField

Detailed Description

Definition at line 115 of file SauvMedConvertor.hxx.


Constructor & Destructor Documentation

SauvUtilities::DoubleField::DoubleField ( int  nb_sub,
int  total_nb_comp 
) [inline]

Definition at line 150 of file SauvMedConvertor.hxx.

      : _sub(nb_sub), _group(NULL), _curMedField(NULL) { _comp_values.reserve( total_nb_comp ); }

Member Function Documentation

std::vector< double > & DoubleField::addComponent ( int  nb_values)

Return a vector ready to fill in.

Definition at line 2194 of file SauvMedConvertor.cxx.

{
  _comp_values.push_back( std::vector< double >() );
  std::vector< double >& res = _comp_values.back();
  res.resize( nb_values );
  return res;
}

Return TypeOfTimeDiscretization.

Definition at line 2305 of file SauvMedConvertor.cxx.

{
  return ONE_TIME;
  // NO_TIME = 4,
  // ONE_TIME = 5,
  // LINEAR_TIME = 6,
  // CONST_ON_TIME_INTERVAL = 7
}

Here is the caller graph for this function:

ParaMEDMEM::TypeOfField DoubleField::getMedType ( const int  iSub = 0) const

Return type of MEDCouplingFieldDouble.

Definition at line 2283 of file SauvMedConvertor.cxx.

{
  using namespace INTERP_KERNEL;

  const Group* grp = hasCommonSupport() ? _group : _sub[iSub]._support;
  if ( _sub[iSub].nbGauss() > 1 )
    {
      const CellModel& cm = CellModel::GetCellModel( _sub[iSub]._support->_cellType );
      return (int) cm.getNumberOfNodes() == _sub[iSub].nbGauss() ? ON_GAUSS_NE : ON_GAUSS_PT;
    }
  else
    {
      return getDim( grp ) == 0 ? ON_NODES : ON_CELLS;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int SauvUtilities::DoubleField::getNbGauss ( const int  iSub = 0) const
int DoubleField::getNbTuples ( const int  iSub = 0) const

Return nb tuples to be used to allocate DataArrayDouble.

Definition at line 2320 of file SauvMedConvertor.cxx.

{
  int nb = 0;
  if ( hasCommonSupport() && !_group->_groups.empty() )
    for ( size_t i = 0; i < _group->_groups.size(); ++i )
      nb += _sub[i].nbGauss() * _sub[i]._support->size();
  else
    nb = _sub[iSub].nbGauss() * getSupport(iSub)->size();
  return nb;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int SauvUtilities::DoubleField::getNbValuesPerElement ( const int  iSub = 0) const
const Group * DoubleField::getSupport ( const int  iSub = 0) const

Returns a supporting group.

Definition at line 2207 of file SauvMedConvertor.cxx.

{
  return _group ? _group : _sub[iSub]._support;
}

Here is the caller graph for this function:

Definition at line 153 of file SauvMedConvertor.hxx.

{ return _group; } // true if there is one support for all subs

Here is the caller graph for this function:

return true if all sub-components has same components and same nbGauss

Definition at line 2261 of file SauvMedConvertor.cxx.

{
  vector< _Sub_data >::const_iterator sub_data = _sub.begin();
  const _Sub_data& first_sub_data = *sub_data;
  for ( ++sub_data ; sub_data != _sub.end(); ++sub_data )
  {
    if ( first_sub_data._comp_names != sub_data->_comp_names )
      return false; // diff names of components

    if ( first_sub_data._nb_gauss != sub_data->_nb_gauss &&
         first_sub_data._support->_cellType == sub_data->_support->_cellType)
      return false; // diff nb of gauss points on same cell type
  }
  return true;
}

True if the field can be converted into the med field.

Definition at line 2236 of file SauvMedConvertor.cxx.

{
  for ( size_t iSub = 0; iSub < _sub.size(); ++iSub )
    {
      if ( !getSupport(iSub) || !getSupport(iSub)->_medGroup )
        THROW_IK_EXCEPTION("SauvReader INTERNAL ERROR: NULL field support");

      if ( !_sub[iSub].isValidNbGauss() )
        {
          cout << "Skip field <" << _name << "> : different nb of gauss points in components" <<endl;
          return false;
        }
    }
  // check if there are no gauss or nbGauss() == nbCellNodes,
  // else we lack info on gauss point localization
  // TODO?
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Return true if each sub-component is a time stamp.

Definition at line 2218 of file SauvMedConvertor.cxx.

{
  if ( _sub.size() < 2 )
    return false;
  bool sameSupports = true;
  Group* grp1 = _sub[0]._support;
  for ( size_t i = 1; i < _sub.size() && sameSupports; ++i )
    sameSupports = ( grp1 == _sub[i]._support );

  return sameSupports;
}
int DoubleField::setValues ( double *  valPtr,
const int  iSub,
const int  elemShift = 0 
) const

Store values of a sub-component and return nb of elements in the iSub.

Definition at line 2337 of file SauvMedConvertor.cxx.

{
  // find values for iSub
  int iComp = 0;
  for ( int iS = 0; iS < iSub; ++iS )
    iComp += _sub[iS].nbComponents();
  const vector< double > * compValues = &_comp_values[ iComp ];

  const vector< unsigned >& relocTable = getSupport( iSub )->_relocTable;

  // Set values

  const int nbElems      = _sub[iSub]._support->size();
  const int nbGauss      = _sub[iSub].nbGauss();
  const int nbComponents = _sub[iSub].nbComponents();
  const int nbValsByElem = nbComponents * nbGauss;
  // check nb values
  int nbVals = 0;
  for ( iComp = 0; iComp < nbComponents; ++iComp )
    nbVals += compValues[iComp].size();
  if ( nbVals != nbElems * nbValsByElem )
    THROW_IK_EXCEPTION("SauvMedConvertor.cxx: support size mismatches field size");
  // compute nb values in previous subs
  int valsShift = 0;
  for ( int iS = iSub-1, shift = elemShift; shift > 0; )
  {
    int nbE = _sub[iS]._support->size();
    shift -= nbE;
    valsShift += nbE * _sub[iS].nbComponents() * _sub[iS].nbGauss();
  }
  for ( int iE = 0; iE < nbElems; ++iE )
    {
      int iMed = valsShift + nbValsByElem * ( relocTable.empty() ? iE : relocTable[iE+elemShift]-elemShift );
      for ( iComp = 0; iComp < nbComponents; ++iComp )
        for ( int iG = 0; iG < nbGauss; ++iG )
          valPtr[ iMed + iG * nbComponents + iComp ] = compValues[iComp][ iE * nbGauss + iG ];
    }
  return nbElems;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

std::vector< std::vector< double > > SauvUtilities::DoubleField::_comp_values

Definition at line 147 of file SauvMedConvertor.hxx.

Definition at line 148 of file SauvMedConvertor.hxx.

Definition at line 139 of file SauvMedConvertor.hxx.

Definition at line 141 of file SauvMedConvertor.hxx.

Definition at line 137 of file SauvMedConvertor.hxx.

Definition at line 138 of file SauvMedConvertor.hxx.

Definition at line 140 of file SauvMedConvertor.hxx.


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