Back to index

salome-med  6.5.0
Classes | Namespaces | Defines | Enumerations | Functions | Variables
MEDMEM_GibiMeshDriver.cxx File Reference
#include <algorithm>
#include <queue>
#include <list>
#include "MEDMEM_GibiMeshDriver.hxx"
#include <rpc/xdr.h>
#include "MEDMEM_DriversDef.hxx"
#include "MEDMEM_Family.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_Group.hxx"
#include "MEDMEM_Coordinate.hxx"
#include "MEDMEM_Connectivity.hxx"
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_CellModel.hxx"
#include "MEDMEM_define.hxx"
#include "MEDMEM_DriverTools.hxx"
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <float.h>

Go to the source code of this file.

Classes

class  TFieldCounter

Namespaces

namespace  MEDMEM
 A template class to generate an array of any particular type (int, long, float, double) for our purpose in the MED++ library.

Defines

#define GIBI_EQUAL(var_str, stat_str)   (strncmp (var_str, stat_str, strlen(stat_str)) == 0)
#define DUMP_LINE_NB   " on line " << _lineNb

Enumerations

enum  Readable_Piles {
  PILE_SOUS_MAILLAGE = 1, PILE_NODES_FIELD = 2, PILE_TABLES = 10, PILE_LREEL = 18,
  PILE_LOGIQUES = 24, PILE_FLOATS = 25, PILE_INTEGERS = 26, PILE_STRINGS = 27,
  PILE_LMOTS = 29, PILE_NOEUDS = 32, PILE_COORDONNEES = 33, PILE_MODL = 38,
  PILE_FIELD = 39, PILE_LAST_READABLE = 39
}

Functions

static int getGroupId (const vector< int > &support_ids, _intermediateMED *medi)
static bool isNamedObject (int obj_index, const vector< int > &indices_objets_nommes)
static void setFieldNames (const vector< _fieldBase * > &fields, const vector< string > &objets_nommes, const vector< int > &indices_objets_nommes)
static void getReverseVector (const medGeometryElement type, vector< pair< int, int > > &swapVec)
static void reverse (const _maille &aMaille, const vector< pair< int, int > > &swapVec)
static const int * getGibi2MedConnectivity (const medGeometryElement type)
static void fixConnectivity (const _maille &aMaille)
static void orientElements (_intermediateMED &medi)
static string cleanName (const string &theName)
template<class T , class INTERLACING_TAG >
static void writeDataSection (fstream &file, const FIELD< T, INTERLACING_TAG > *field, const int id1, const int id2) throw (MEDEXCEPTION)

Variables

const int GIBI_MaxOutputLen = 150
const int GIBI_BufferSize = 16184

Define Documentation

#define DUMP_LINE_NB   " on line " << _lineNb

Definition at line 237 of file MEDMEM_GibiMeshDriver.cxx.

#define GIBI_EQUAL (   var_str,
  stat_str 
)    (strncmp (var_str, stat_str, strlen(stat_str)) == 0)

Definition at line 235 of file MEDMEM_GibiMeshDriver.cxx.


Enumeration Type Documentation

Enumerator:
PILE_SOUS_MAILLAGE 
PILE_NODES_FIELD 
PILE_TABLES 
PILE_LREEL 
PILE_LOGIQUES 
PILE_FLOATS 
PILE_INTEGERS 
PILE_STRINGS 
PILE_LMOTS 
PILE_NOEUDS 
PILE_COORDONNEES 
PILE_MODL 
PILE_FIELD 
PILE_LAST_READABLE 

Definition at line 99 of file MEDMEM_GibiMeshDriver.cxx.


Function Documentation

static string cleanName ( const string &  theName) [static]

Definition at line 2679 of file MEDMEM_GibiMeshDriver.cxx.

{
  string name = theName;
  if ( !name.empty() ) {
    /*
    // find a name string end
    int i, len = name.length();
    for ( i = 0; i < len; ++i ) {
      if ( name[i] == 0 )
        break;
    }
    // cut off trailing white spaces
    while ( i > 0 && name[i-1] == ' ' )
      i--;
    if ( i != len ) {
      name = name.substr( 0, i );
      len = i;
    }
    */
    // cut off leading white spaces
    string::size_type firstChar = name.find_first_not_of(" \t");
    if (firstChar < name.length())
    {
      name = name.substr(firstChar);
    }
    else
    {
      name = ""; // only whitespaces there - remove them
    }
    // cut off trailing white spaces
    string::size_type lastChar = name.find_last_not_of(" \t");
    if (lastChar < name.length()) {
      name = name.substr(0, lastChar + 1);
    }
  }
  return name;
}
static void fixConnectivity ( const _maille &  aMaille) [inline, static]

Definition at line 2117 of file MEDMEM_GibiMeshDriver.cxx.

{
  if ( const int * conn = getGibi2MedConnectivity( aMaille.geometricType )) {
    _maille* ma = (_maille*) & aMaille;
    //cout << "###### BEFORE fixConnectivity() " << *ma << endl;
    vector< _maille::TNoeud > newSommets( ma->sommets.size() );
    for ( unsigned i = 0; i < newSommets.size(); ++i )
      newSommets[ i ] = ma->sommets[ conn[ i ]];
    ma->sommets = newSommets;
    //cout << "###### AFTER fixConnectivity() " << *ma << endl;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const int* getGibi2MedConnectivity ( const medGeometryElement  type) [static]

Definition at line 2089 of file MEDMEM_GibiMeshDriver.cxx.

{
  static vector<const int*> conn;
  static int hexa20 [] = {0,6,4,2, 12,18,16,14, 7,5,3,1, 19,17,15,13, 8,11,10,9};
  static int penta15[] = {0,2,4, 9,11,13, 1,3,5, 10,12,14, 6,7,3};
  static int pyra13 [] = {0,2,4,6, 12, 1,3,5,7, 8,9,10,11};
  static int tetra10[] = {0,2,4, 9, 1,3,5, 6,7,8};
  static int quad8  [] = {0,2,4,6, 1,3,5,7};
  static int tria6  [] = {0,2,4, 1,3,5};
  static int seg3   [] = {0,2,1};
  if ( conn.empty() ) {
    conn.resize( MED_HEXA20 + 1, 0 );
    conn[ MED_HEXA20 ] = hexa20;
    conn[ MED_PENTA15] = penta15;
    conn[ MED_PYRA13 ] = pyra13;
    conn[ MED_TETRA10] = tetra10;
    conn[ MED_SEG3   ] = seg3;
    conn[ MED_TRIA6  ] = tria6;
    conn[ MED_QUAD8  ] = quad8;
  }
  return conn[ type ];
}

Here is the caller graph for this function:

static int getGroupId ( const vector< int > &  support_ids,
_intermediateMED *  medi 
) [static]

Definition at line 149 of file MEDMEM_GibiMeshDriver.cxx.

{
  int group_id = 0;
  vector<int>::const_iterator sb = support_ids.begin(), se = support_ids.end();
  if (support_ids.size() == 1 || // one or equal support ids
      *std::max_element( sb, se ) == *std::min_element( sb, se ))
  {
    group_id = support_ids[0] - 1;
  }
  else
  {
    // try to find an existing group with the same sub-groups
    set<int> sup_set;
    sup_set.insert( sb, se );

    for ( group_id = 0; group_id < (int)medi->groupes.size(); ++group_id )
    {
      if (sup_set.size() == medi->groupes[ group_id ].groupes.size() &&
          std::equal (sup_set.begin(), sup_set.end(),
                      medi->groupes[ group_id ].groupes.begin()))
        break;
    }
    if ( group_id == (int)medi->groupes.size() )
    {
      // no such a group, add a new one
      medi->groupes.push_back( _groupe() );
      _groupe& new_grp = medi->groupes.back();
      new_grp.groupes.reserve( sup_set.size() );
      for ( set<int>::iterator it = sup_set.begin(); it != sup_set.end(); it++ ) {
        new_grp.groupes.push_back( *it );
      }
    }
  }
  return group_id;
}
static void getReverseVector ( const medGeometryElement  type,
vector< pair< int, int > > &  swapVec 
) [static]

Definition at line 1990 of file MEDMEM_GibiMeshDriver.cxx.

{
  const char* LOC = "void getReverseVector()";
  BEGIN_OF_MED(LOC);
  swapVec.clear();

  switch ( type ) {
  case MED_TETRA4:
    swapVec.resize(1);
    swapVec[0] = make_pair( 1, 2 );
    break;
  case MED_PYRA5:
    swapVec.resize(1);
    swapVec[0] = make_pair( 1, 3 );
    break;
  case MED_PENTA6:
    swapVec.resize(2);
    swapVec[0] = make_pair( 1, 2 );
    swapVec[1] = make_pair( 4, 5 );
    break;
  case MED_HEXA8:
    swapVec.resize(2);
    swapVec[0] = make_pair( 1, 3 );
    swapVec[1] = make_pair( 5, 7 );
    break;
  case MED_TETRA10:
    swapVec.resize(3);
    swapVec[0] = make_pair( 1, 2 );
    swapVec[1] = make_pair( 4, 6 );
    swapVec[2] = make_pair( 8, 9 );
    break;
  case MED_PYRA13:
    swapVec.resize(4);
    swapVec[0] = make_pair( 1, 3 );
    swapVec[1] = make_pair( 5, 8 );
    swapVec[2] = make_pair( 6, 7 );
    swapVec[3] = make_pair( 10, 12 );
    break;
  case MED_PENTA15:
    swapVec.resize(4);
    swapVec[0] = make_pair( 1, 2 );
    swapVec[1] = make_pair( 4, 5 );
    swapVec[2] = make_pair( 6, 8 );
    swapVec[3] = make_pair( 9, 11 );
    break;
  case MED_HEXA20:
    swapVec.resize(7);
    swapVec[0] = make_pair( 1, 3 );
    swapVec[1] = make_pair( 5, 7 );
    swapVec[2] = make_pair( 8, 11 );
    swapVec[3] = make_pair( 9, 10 );
    swapVec[4] = make_pair( 12, 15 );
    swapVec[5] = make_pair( 13, 14 );
    swapVec[6] = make_pair( 17, 19 );
    break;
//   case MED_SEG3: no need to reverse edges
//     swapVec.resize(1);
//     swapVec[0] = make_pair( 1, 2 );
//     break;
  case MED_TRIA6:
    swapVec.resize(2);
    swapVec[0] = make_pair( 1, 2 );
    swapVec[1] = make_pair( 3, 5 );
    break;
  case MED_QUAD8:
    swapVec.resize(3);
    swapVec[0] = make_pair( 1, 3 );
    swapVec[1] = make_pair( 4, 7 );
    swapVec[2] = make_pair( 5, 6 );
    break;
  default:;
  }
  END_OF_MED(LOC);
}

Here is the caller graph for this function:

static bool isNamedObject ( int  obj_index,
const vector< int > &  indices_objets_nommes 
) [inline, static]

Definition at line 191 of file MEDMEM_GibiMeshDriver.cxx.

{
  return ( std::find( indices_objets_nommes.begin(), indices_objets_nommes.end(), obj_index)
           != indices_objets_nommes.end() );
}

Here is the caller graph for this function:

static void orientElements ( _intermediateMED &  medi) [static]

Definition at line 2135 of file MEDMEM_GibiMeshDriver.cxx.

{
  MESSAGE_MED("orientElements()");

  set<_maille>::const_iterator elemIt, elemEnd;

  int type = -100;
  vector< pair<int,int> > swapVec;

  bool isQuadratic = false;

  if ( medi.points.begin()->second.coord.size() == 2 ) { // space dimension

    // fix connectivity of quadratic edges
    _maillageByDimIterator edgesIt( medi, /*dim=*/1);
    while ( const set<_maille > * edges = edgesIt.nextType() )
    {
      isQuadratic = getGibi2MedConnectivity( edgesIt.type() );
      if (isQuadratic )
      {
        elemIt = edges->begin(), elemEnd = edges->end();
        for ( ; elemIt != elemEnd; ++elemIt )
          fixConnectivity( *elemIt );
      }
    }
    // --------------------------
    // Orient 2D faces clockwise
    // --------------------------

    _maillageByDimIterator faceMailIt( medi, /*dim=*/2 );
    while ( const set<_maille > * faces = faceMailIt.nextType() )
    {
      isQuadratic = getGibi2MedConnectivity( faceMailIt.type() );
      elemIt = faces->begin(), elemEnd = faces->end();
      for ( ; elemIt != elemEnd; elemIt++ )
      {
        // fix connectivity of quadratic faces
        if ( isQuadratic )
          fixConnectivity( *elemIt );

        // look for index of the most left node
        int iLeft = 0, iNode, nbNodes = elemIt->sommets.size();
        if ( nbNodes > 4 ) // quadratic face
          nbNodes /= 2;
        double minX = elemIt->sommets[0]->second.coord[0];
        for ( iNode = 1; iNode < nbNodes; ++iNode )
        {
          if ( minX > elemIt->sommets[ iNode ]->second.coord[ 0 ]) {
            minX = elemIt->sommets[ iNode ]->second.coord[ 0 ];
            iLeft = iNode;
          }
        }
        // indeces of the nodes neighboring the most left one
        int iPrev = ( iLeft - 1 < 0 ) ? nbNodes - 1 : iLeft - 1;
        int iNext = ( iLeft + 1 == nbNodes ) ? 0 : iLeft + 1;
        // find components of prev-left and left-next vectors
        double xP = elemIt->sommets[ iPrev ]->second.coord[ 0 ];
        double yP = elemIt->sommets[ iPrev ]->second.coord[ 1 ];
        double xN = elemIt->sommets[ iNext ]->second.coord[ 0 ];
        double yN = elemIt->sommets[ iNext ]->second.coord[ 1 ];
        double xL = elemIt->sommets[ iLeft ]->second.coord[ 0 ];
        double yL = elemIt->sommets[ iLeft ]->second.coord[ 1 ];
        double xPL = xL - xP, yPL = yL - yP; // components of prev-left vector
        double xLN = xN - xL, yLN = yN - yL; // components of left-next vector
        // normalise y of the vectors
        double modPL = sqrt ( xPL * xPL + yPL * yPL );
        double modLN = sqrt ( xLN * xLN + yLN * yLN );
        if ( modLN > DBL_MIN && modPL > DBL_MIN )
        {
          yPL /= modPL;
          yLN /= modLN;
          // summury direction of neighboring links must be positive
          bool clockwise = ( yPL + yLN > 0 );
          if ( !clockwise ) {
            if ( elemIt->geometricType != type ) {
              type = elemIt->geometricType;
              getReverseVector( type, swapVec );
            }
            reverse( *elemIt, swapVec );
          }
        }
      }
    }
  }
  else {

    // --------------------------------------
    // orient equally all connected 3D faces
    // --------------------------------------
    // connectivity of quadratic faces will be fixed by fixConnectivity()
    // in the next loop on elements

    // fill map of links and their faces
    set<const _maille*> faces;
    map<const _maille*, _groupe*> fgm;
    map<_link, list<const _maille*> > linkFacesMap;
    map<_link, list<const _maille*> >::iterator lfIt, lfIt2;

    medi.treatGroupes(); // erase groupes that wont be converted
    for (unsigned int i=0; i!=medi.groupes.size(); ++i)
    {
      _groupe& grp = medi.groupes[i];
      _groupe::TMailleIter maIt=grp.mailles.begin();
      if ( maIt==grp.mailles.end() || (*maIt)->dimensionWithPoly() != 2 )
        continue;
      for(; maIt!=grp.mailles.end(); ++maIt) {
        if ( faces.insert( &(**maIt )).second ) {
          for ( int j = 0; j < (int)(*maIt)->sommets.size(); ++j )
            linkFacesMap[ (*maIt)->link( j ) ].push_back( &(**maIt) );
          fgm.insert( make_pair( &(**maIt), &grp ));
        }
      }
    }
    // dump linkFacesMap
//     for ( lfIt = linkFacesMap.begin(); lfIt!=linkFacesMap.end(); lfIt++) {
//       cout<< "LINK: " << lfIt->first.first << "-" << lfIt->first.second << endl;
//       list<const _maille*> & fList = lfIt->second;
//       list<const _maille*>::iterator fIt = fList.begin();
//       for ( ; fIt != fList.end(); fIt++ )
//         cout << "\t" << **fIt << fgm[*fIt]->nom << endl;
//     }

    // Each oriented link must appear in one face only, else a face is reversed.

    queue<const _maille*> faceQueue; // the queue contains well oriented faces
    // whose neighbors orientation is to be checked

    bool manifold = true;
    while ( !linkFacesMap.empty() )
    {
      if ( faceQueue.empty() ) {
        ASSERT_MED( !linkFacesMap.begin()->second.empty() );
        faceQueue.push( linkFacesMap.begin()->second.front() );
      }
      while ( !faceQueue.empty() )
      {
        const _maille* face = faceQueue.front();
        faceQueue.pop();

        // loop on links of <face>
        for ( int i = 0; i < (int)face->sommets.size(); ++i ) {
          _link link = face->link( i );
          // find the neighbor faces
          lfIt = linkFacesMap.find( link );
          int nbFaceByLink = 0;
          list< const _maille* > ml;
          if ( lfIt != linkFacesMap.end() )
          {
            list<const _maille*> & fList = lfIt->second;
            list<const _maille*>::iterator fIt = fList.begin();
            ASSERT_MED( fIt != fList.end() );
            for ( ; fIt != fList.end(); fIt++, nbFaceByLink++ ) {
              ml.push_back( *fIt );
              if ( *fIt != face ) // wrongly oriented neighbor face
              {
                const _maille* badFace = *fIt;
                // reverse and remove badFace from linkFacesMap
                for ( int j = 0; j < (int)badFace->sommets.size(); ++j ) {
                  _link badlink = badFace->link( j );
                  if ( badlink == link ) continue;
                  lfIt2 = linkFacesMap.find( badlink );
                  if ( lfIt2 != linkFacesMap.end() ) {
                    list<const _maille*> & ff = lfIt2->second;
                    ff.erase( find( ff.begin(), ff.end(), badFace ));
                        if ( ff.empty() )
                          linkFacesMap.erase( lfIt2 );
                  }
                }
                badFace->reverse = true; // reverse
                //INFOS_MED( "REVERSE " << *badFace );
                faceQueue.push( badFace );
              }
            }
            linkFacesMap.erase( lfIt );
          }
          // add good neighbors to the queue
          _link revLink( link.second, link.first );
          lfIt = linkFacesMap.find( revLink );
          if ( lfIt != linkFacesMap.end() )
          {
            list<const _maille*> & fList = lfIt->second;
            list<const _maille*>::iterator fIt = fList.begin();
            for ( ; fIt != fList.end(); fIt++, nbFaceByLink++ ) {
              ml.push_back( *fIt );
              if ( *fIt != face )
                faceQueue.push( *fIt );
            }
            linkFacesMap.erase( lfIt );
          }
          if ( nbFaceByLink > 2 ) {
            if ( manifold ) {
              list<const _maille*>::iterator i = ml.begin();
              INFOS_MED(nbFaceByLink << " faces by 1 link:");
              for( ; i!= ml.end(); i++ ) {
                INFOS_MED("in object " << fgm[ *i ]->nom);
                INFOS_MED( **i );
              }
            }
            manifold = false;
          }
        } // loop on links of the being checked face
      } // loop on the face queue
    } // while ( !linkFacesMap.empty() )

    if ( !manifold )
      INFOS_MED(" -> Non manifold mesh, faces orientation may be incorrect");


    // ---------------------------------------------------
    // fix connectivity of quadratic elements
    // ---------------------------------------------------

    for ( int dim = 1; dim <= 3; ++dim )
    {
      _maillageByDimIterator mailIt( medi, dim );
      while ( const set<_maille > * elems = mailIt.nextType() )
      {
        isQuadratic = getGibi2MedConnectivity( mailIt.type() );
        elemIt = elems->begin(), elemEnd = elems->end();
        for ( ; elemIt != elemEnd; elemIt++ )
        {
          // GIBI connectivity -> MED one
          if ( isQuadratic )
            fixConnectivity( *elemIt );

          // reverse quadratic faces
          if ( elemIt->reverse ) {
            if ( elemIt->geometricType != type ) {
              type = elemIt->geometricType;
              getReverseVector( type, swapVec );
            }
            reverse ( *elemIt, swapVec );
          }
        }
      }
    }

    // ---------------------------------------------------
    // Orient volumes according to MED conventions:
    // normal of a bottom (first) face should be downward
    // ---------------------------------------------------

    _maillageByDimIterator mailIt( medi, 3 );
    while ( const set<_maille > * elems = mailIt.nextType() )
    {
      elemIt = elems->begin(), elemEnd = elems->end();
      int nbBottomNodes = 0;
      switch ( elemIt->geometricType ) {
      case MED_TETRA4:
      case MED_TETRA10:
      case MED_PENTA6:
      case MED_PENTA15:
        nbBottomNodes = 3; break;
      case MED_PYRA5:
      case MED_PYRA13:
      case MED_HEXA8:
      case MED_HEXA20:
        nbBottomNodes = 4; break;
      default: continue;
      }
      getReverseVector( elemIt->geometricType, swapVec );

      for ( ; elemIt != elemEnd; elemIt++ )
      {
        // find a normal to the bottom face
        const _noeud* n[4] = {
          &elemIt->sommets[0]->second, // 3 bottom nodes
          &elemIt->sommets[1]->second,
          &elemIt->sommets[2]->second,
          &elemIt->sommets[nbBottomNodes]->second };// a top node
        double vec01 [3] = { // vector n[0]-n[1]
          n[1]->coord[0] - n[0]->coord[0],
          n[1]->coord[1] - n[0]->coord[1],
          n[1]->coord[2] - n[0]->coord[2], };
        double vec02 [3] = { // vector n[0]-n[2]
          n[2]->coord[0] - n[0]->coord[0],
          n[2]->coord[1] - n[0]->coord[1],
          n[2]->coord[2] - n[0]->coord[2] };
        double normal [3] = { // vec01 ^ vec02
          vec01[1] * vec02[2] - vec01[2] * vec02[1],
          vec01[2] * vec02[0] - vec01[0] * vec02[2],
          vec01[0] * vec02[1] - vec01[1] * vec02[0] };
        // check if the 102 angle is convex
        if ( nbBottomNodes > 3 ) {
          const _noeud* n3 = &elemIt->sommets[nbBottomNodes-1]->second;// last bottom node
          double vec03 [3] = { // vector n[0]-n3
            n3->coord[0] - n[0]->coord[0],
            n3->coord[1] - n[0]->coord[1],
            n3->coord[2] - n[0]->coord[2], };
          if ( fabs( normal[0]+normal[1]+normal[2] ) <= DBL_MIN ) { // vec01 || vec02
            normal[0] = vec01[1] * vec03[2] - vec01[2] * vec03[1]; // vec01 ^ vec03
            normal[1] = vec01[2] * vec03[0] - vec01[0] * vec03[2];
            normal[2] = vec01[0] * vec03[1] - vec01[1] * vec03[0];
          }
          else {
            double vec [3] = { // normal ^ vec01
              normal[1] * vec01[2] - normal[2] * vec01[1],
              normal[2] * vec01[0] - normal[0] * vec01[2],
              normal[0] * vec01[1] - normal[1] * vec01[0] };
            double dot2 = vec[0]*vec03[0] + vec[1]*vec03[1] + vec[2]*vec03[2]; // vec*vec03
            if ( dot2 < 0 ) { // concave -> reverse normal
              normal[0] *= -1;
              normal[1] *= -1;
              normal[2] *= -1;
            }
          }
        }
        // direction from top to bottom
        double tbDir[3];
        tbDir[0] = n[0]->coord[0] - n[3]->coord[0];
        tbDir[1] = n[0]->coord[1] - n[3]->coord[1];
        tbDir[2] = n[0]->coord[2] - n[3]->coord[2];
        // compare 2 directions: normal and top-bottom
        double dot = normal[0]*tbDir[0] + normal[1]*tbDir[1] + normal[2]*tbDir[2];
        if ( dot < 0. ) // need reverse
        {
          reverse( *elemIt, swapVec );
        }
      } // loop on volumes of one geometry
    } // loop on 3D geometry types

  } // space dimension == 3
}

Here is the call graph for this function:

static void reverse ( const _maille &  aMaille,
const vector< pair< int, int > > &  swapVec 
) [static]

Definition at line 2071 of file MEDMEM_GibiMeshDriver.cxx.

{
  _maille* ma = (_maille*) & aMaille;
  for ( unsigned i = 0; i < swapVec.size(); ++i ) {
    std::swap( ma->sommets[ swapVec[i].first ],
               ma->sommets[ swapVec[i].second ]);
  }
  if ( swapVec.empty() )
    ma->reverse = true;
  else
    ma->reverse = false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void setFieldNames ( const vector< _fieldBase * > &  fields,
const vector< string > &  objets_nommes,
const vector< int > &  indices_objets_nommes 
) [static]

Definition at line 203 of file MEDMEM_GibiMeshDriver.cxx.

{
  // set field names
  unsigned i;
  set<string> fnames;
  for ( i = 0; i < indices_objets_nommes.size(); ++i ) {
    int fieldIndex = indices_objets_nommes[ i ];
    fnames.insert( objets_nommes[ i ]);
    if ( fields[ fieldIndex - 1 ] )
      fields[ fieldIndex - 1 ]->_name = objets_nommes[ i ];
  }
  int noNameIndex = 0;
  for ( i = 0; i < fields.size(); ++i ) {
    if ( !fields[ i ] ) {
      if ( !isNamedObject( i+1, indices_objets_nommes ))
        ++noNameIndex;
    }
    else if ( fields[ i ]->_name.empty() ) {
      do {
        fields[ i ]->_name = STRING("F_") << ++noNameIndex;
      } while ( !fnames.insert( fields[ i ]->_name ).second );
    }
  }
}

Here is the call graph for this function:

template<class T , class INTERLACING_TAG >
static void writeDataSection ( fstream &  file,
const FIELD< T, INTERLACING_TAG > *  field,
const int  id1,
const int  id2 
) throw (MEDEXCEPTION) [static]

Definition at line 3852 of file MEDMEM_GibiMeshDriver.cxx.

{
  const char * LOC="writeDataSection (.....) :";
  BEGIN_OF_MED(LOC);

  int nbGauss, nbComp = field->getNumberOfComponents();

  typedef typename MEDMEM_ArrayInterface<T,INTERLACING_TAG,NoGauss>::Array ArrayNoGauss;
  typedef typename MEDMEM_ArrayInterface<T,INTERLACING_TAG,Gauss>::Array   ArrayGauss;

  MEDMEM_Array_ * array        = field->getArray();
  ArrayNoGauss  * arrayNoGauss = 0;
  ArrayGauss    * arrayGauss   = 0;

  if ( !array )
    throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" Field |"<< field->getName()
                                 << "| not allocated"));

  if ( array->getGaussPresence() ) {
    arrayGauss = field->getArrayGauss();
    nbGauss    = arrayGauss->getNbGauss( id1 );
  }
  else {
    arrayNoGauss = field->getArrayNoGauss();
    nbGauss      = 1;
  }

  TFieldCounter fcount( file, 3 ); // 3 values on a line

#ifdef CASTEM_FULL_INTERLACE
  const int gauss_step = field->getInterlacingType() == MED_EN::MED_FULL_INTERLACE ? nbComp : 1;
#endif
  const bool isNodal = ( field->getSupport()->getEntity() == MED_EN::MED_NODE );

  for ( int iComp = 1; iComp <= nbComp; ++iComp )
  {
    if ( !isNodal )
      file << setw(8) << nbGauss       // nb scalar values by element
           << setw(8) << ( id2 - id1 ) // total nb of scalar values
           << setw(8) << 0
           << setw(8) << 0
           << endl;

    // * 8003   FORMAT(1P,3E22.14)
    if ( arrayNoGauss ) {
      for (int id = id1; id < id2; id++, fcount++ )
        file << setw(22) << arrayNoGauss->getIJ( id, iComp );
    }
    else {
#ifdef CASTEM_FULL_INTERLACE
      for (int id = id1; id < id2; id++ ) {
        const T* val = & arrayGauss->getIJK( id, iComp, 1 );
        const T* valEnd = val + nbGauss * gauss_step;
        for ( ; val < valEnd; val += gauss_step, fcount++ )
          file << setw(22) << *val;
      }
#else
      for ( int iGauss = 1; iGauss <= nbGauss; ++iGauss ) {
        for (int id = id1; id < id2; id++, fcount++  )
          file << setw(22) << arrayGauss->getIJK( id, iComp, iGauss );
      }
#endif
    }
    fcount.stop();
  }
  END_OF_MED(LOC);
}

Here is the call graph for this function:


Variable Documentation

const int GIBI_BufferSize = 16184

Definition at line 1506 of file MEDMEM_GibiMeshDriver.cxx.

const int GIBI_MaxOutputLen = 150

Definition at line 1505 of file MEDMEM_GibiMeshDriver.cxx.