Back to index

salome-med  6.5.0
Public Member Functions | Public Attributes
ICoCo::TrioField Class Reference

#include <ICoCoTrioField.hxx>

Inheritance diagram for ICoCo::TrioField:
Inheritance graph
[legend]
Collaboration diagram for ICoCo::TrioField:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TrioField ()
 TrioField (const TrioField &OtherField)
 ~TrioField ()
void clear ()
void set_standalone ()
void dummy_geom ()
TrioFieldoperator= (const TrioField &NewField)
void save (std::ostream &os) const
void restore (std::istream &in)
int nb_values () const
void setName (const std::string &name)
const std::string & getName () const
const char * getCharName () const

Public Attributes

int _type
int _mesh_dim
int _space_dim
int _nbnodes
int _nodes_per_elem
int _nb_elems
int _itnumber
int * _connectivity
double * _coords
double _time1
double _time2
int _nb_field_components
double * _field
bool _has_field_ownership

Detailed Description

Definition at line 42 of file ICoCoTrioField.hxx.


Constructor & Destructor Documentation

Definition at line 33 of file ICoCoTrioField.cxx.

TrioField::TrioField ( const TrioField OtherField)

Definition at line 50 of file ICoCoTrioField.cxx.

                                               :_connectivity(0),_coords(0),_field(0) {
  (*this)=OtherField;
}

Definition at line 55 of file ICoCoTrioField.cxx.

                      {
  clear();
}

Here is the call graph for this function:


Member Function Documentation

void TrioField::clear ( )

Definition at line 61 of file ICoCoTrioField.cxx.

                      {
  if (_connectivity)
    delete[] _connectivity;
  if (_coords)
    delete[] _coords;
  if (_field && _has_field_ownership)
    delete[] _field;
  _connectivity=0;
  _coords=0;
  _field=0;
  _has_field_ownership=false;
}

Here is the caller graph for this function:

Definition at line 197 of file ICoCoTrioField.cxx.

                           {
  _type=0;
  _mesh_dim=2;
  _space_dim=2;
  _nbnodes=3;
  _nodes_per_elem=3;
  _nb_elems=1;
  _itnumber=0;
  if (_connectivity)
    delete[] _connectivity;
  _connectivity=new int[3];
  _connectivity[0]=0;
  _connectivity[1]=1;
  _connectivity[2]=2;
  if (_coords)
    delete[] _coords;
  _coords=new double[6];
  _coords[0]=0;
  _coords[1]=0;
  _coords[2]=1;
  _coords[3]=0;
  _coords[4]=0;
  _coords[5]=1;
  _time1=0;
  _time2=1;
  _nb_field_components=1;
  if (_field && _has_field_ownership)
    delete[] _field;
  _has_field_ownership=false;
  _field=0;
}
const char * Field::getCharName ( ) const [inherited]

Definition at line 46 of file ICoCoField.cxx.

                                     {
  return _name->c_str();
}
const string & Field::getName ( ) const [inherited]

Definition at line 42 of file ICoCoField.cxx.

                                   {
  return *_name;
}

Here is the caller graph for this function:

int TrioField::nb_values ( ) const

Definition at line 76 of file ICoCoTrioField.cxx.

                               {
  if (_type==0)
    return _nb_elems;
  else if (_type==1)
    return _nbnodes;
  throw 0;
  return -1;
}

Here is the caller graph for this function:

TrioField & TrioField::operator= ( const TrioField NewField)

Definition at line 233 of file ICoCoTrioField.cxx.

                                                        {

  clear();

  _type=NewField._type;
  _mesh_dim=NewField._mesh_dim;
  _space_dim=NewField._space_dim;
  _nbnodes=NewField._nbnodes;
  _nodes_per_elem=NewField._nodes_per_elem;
  _nb_elems=NewField._nb_elems;
  _itnumber=NewField._itnumber;
  _time1=NewField._time1;
  _time2=NewField._time2;
  _nb_field_components=NewField._nb_field_components;

  if (!NewField._connectivity)
    _connectivity=0;
  else {
    _connectivity=new int[_nodes_per_elem*_nb_elems];
    memcpy( _connectivity,NewField._connectivity,_nodes_per_elem*_nb_elems*sizeof(int));
  }

  if (!NewField._coords)
    _coords=0;
  else {
    _coords=new double[_nbnodes*_space_dim];
    memcpy( _coords,NewField._coords,_nbnodes*_space_dim*sizeof(double));
  }

  //Copie des valeurs du champ
  _has_field_ownership=NewField._has_field_ownership;
  if (_has_field_ownership) {
    _field=new double[nb_values()*_nb_field_components];
    memcpy(_field,NewField._field,nb_values()*_nb_field_components*sizeof(double));
  }
  else
    _field=NewField._field;

  return(*this);

}

Here is the call graph for this function:

void TrioField::restore ( std::istream &  in)

Definition at line 130 of file ICoCoTrioField.cxx.

                                   {

  string name;
  in >> name; 
  setName(name);
  in >> _type;
  in >> _mesh_dim;
  in >> _space_dim;
  in >> _nbnodes;
  in >> _nodes_per_elem;
  in >> _nb_elems;
    
  in >> _itnumber;
  if (_connectivity)
    delete [] _connectivity;
  _connectivity=new int[_nodes_per_elem*_nb_elems];
  for (int i=0;i<_nb_elems;i++) {
    for (int j=0;j<_nodes_per_elem;j++)
      in >> _connectivity[i*_nodes_per_elem+j];
  }
  if (_coords)
    delete [] _coords;
  _coords=new double[_nbnodes*_space_dim];
  for (int i=0;i<_nbnodes;i++) {
    for (int j=0;j<_space_dim;j++)
      in >> _coords[i*_space_dim+j];
  }
  
  in >> _time1;
  in >> _time2;
  in >> _nb_field_components;
  int test;
  in >> test;
  if (test) {
    if (_field)
      delete [] _field;
    _field=new double[_nb_field_components*nb_values()];
    for (int i=0;i<nb_values();i++) {
      for (int j=0;j<_nb_field_components;j++)
        in>> _field[i*_nb_field_components+j];
    }
  }
  else
    _field=0;

  in >> _has_field_ownership;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TrioField::save ( std::ostream &  os) const

Definition at line 86 of file ICoCoTrioField.cxx.

                                     {

  os << setprecision(12);
  os << getName() << endl;
  os << _type << endl;
  os << _mesh_dim << endl;
  os << _space_dim << endl;
  os << _nbnodes << endl;
  os << _nodes_per_elem << endl;
  os << _nb_elems << endl;
    
  os<< _itnumber<<endl;
  for (int i=0;i<_nb_elems;i++) {
    for (int j=0;j<_nodes_per_elem;j++)
      os << " " << _connectivity[i*_nodes_per_elem+j];
    os<<endl;
  }
  
  for (int i=0;i<_nbnodes;i++) {
    for (int j=0;j<_space_dim;j++)
      os << " " << _coords[i*_space_dim+j] ;
    os << endl;
  }
  
  os << _time1 << endl;
  os << _time2 << endl;
  os << _nb_field_components << endl;

  if (_field) {
    os << 1 << endl;
    for (int i=0;i<nb_values();i++) {
      for (int j=0;j<_nb_field_components;j++)
        os << " " << _field[i*_nb_field_components+j];
      os << endl;
    }
  }
  else
    os << 0 << endl;

  os << _has_field_ownership << endl;

}

Here is the call graph for this function:

Definition at line 182 of file ICoCoTrioField.cxx.

                               {
  if (!_field) {
    _field=new double[_nb_field_components*nb_values()];
    _has_field_ownership=true;
    
  }
  else if (!_has_field_ownership) {
    double *tmp_field=new double[_nb_field_components*nb_values()];
    memcpy(tmp_field,_field,_nb_field_components*nb_values()*sizeof(double));
    _field=tmp_field;
    _has_field_ownership=true;
  }
}

Here is the call graph for this function:

void Field::setName ( const std::string &  name) [inherited]

Definition at line 38 of file ICoCoField.cxx.

                                      {
  *_name=name;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 64 of file ICoCoTrioField.hxx.

Definition at line 65 of file ICoCoTrioField.hxx.

Definition at line 69 of file ICoCoTrioField.hxx.

Definition at line 70 of file ICoCoTrioField.hxx.

Definition at line 63 of file ICoCoTrioField.hxx.

Definition at line 58 of file ICoCoTrioField.hxx.

Definition at line 62 of file ICoCoTrioField.hxx.

Definition at line 68 of file ICoCoTrioField.hxx.

Definition at line 60 of file ICoCoTrioField.hxx.

Definition at line 61 of file ICoCoTrioField.hxx.

Definition at line 59 of file ICoCoTrioField.hxx.

Definition at line 67 of file ICoCoTrioField.hxx.

Definition at line 67 of file ICoCoTrioField.hxx.

Definition at line 57 of file ICoCoTrioField.hxx.


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