Back to index

salome-smesh  6.5.0
Classes | Typedefs | Enumerations | Functions
UNV2420 Namespace Reference

Classes

struct  MESHDRIVERUNV_EXPORT

Typedefs

typedef int TCSLabel
typedef std::vector< TRecord > TDataSet

Enumerations

enum  { Cartesian = 0, Cylindrical, Spherical }

Functions

MESHDRIVERUNV_EXPORT void Read (std::ifstream &in_stream, std::string &part_name, TDataSet &theDataSet)
MESHDRIVERUNV_EXPORT void Write (std::ofstream &out_stream, const std::string &part_name)

Typedef Documentation

typedef int UNV2420::TCSLabel

Definition at line 88 of file UNV2420_Structure.hxx.

typedef std::vector<TRecord> UNV2420::TDataSet

Definition at line 104 of file UNV2420_Structure.hxx.


Enumeration Type Documentation

anonymous enum
Enumerator:
Cartesian 
Cylindrical 
Spherical 

Definition at line 86 of file UNV2420_Structure.hxx.


Function Documentation

void UNV2420::Read ( std::ifstream &  in_stream,
std::string &  part_name,
TDataSet theDataSet 
)

Definition at line 36 of file UNV2420_Structure.cxx.

{
  if(!in_stream.good())
    EXCEPTION(runtime_error,"ERROR: Input file not good.");

  /*
   * adjust the \p istream to our
   * position
   */
  if(!beginning_of_dataset(in_stream,_label_dataset))
    return;

  string num_buf;
  int part_uid;

  in_stream >> part_uid; // Record 1
  part_name = read_line( in_stream );  // Record 2

  while ( !in_stream.eof() )
  {
    TRecord aRec;

    // Record 3
    in_stream >> aRec.coord_sys_label;
    if ( aRec.coord_sys_label == -1 ) // end of dataset is reached
      break;
    in_stream >> aRec.coord_sys_type;
    in_stream >> aRec.coord_sys_color;

    aRec.coord_sys_name = read_line( in_stream ); // Record 4

    // Records 5-8: rows of Transformation Matrix
    for ( int row = 0; row < 4; ++row )
      for ( int i = 0; i < 3; i++ )
      {
        in_stream >> num_buf;
        aRec.matrix[row][i] = D_to_e(num_buf);
      }
    // Store a CS data only if it requires conversion into the global Cartesian CS
    if ( aRec.coord_sys_type != 0 || !aRec.isIdentityMatrix() ) // 0 - Cartesian CS
      theDataSet.push_back( aRec );
  }
}

Here is the call graph for this function:

void UNV2420::Write ( std::ofstream &  out_stream,
const std::string &  part_name 
)

Definition at line 83 of file UNV2420_Structure.cxx.

{
  if(!out_stream.good())
    EXCEPTION(runtime_error,"ERROR: Output file not good.");
  
  out_stream<<"    -1"  << endl;
  out_stream<<"  "<<_label_dataset << endl;

  out_stream<<"         1"                     << endl; // R1: Part UID
  if ( part_name.empty() )
    out_stream<<"SMESH_Mesh"                   << endl; // R2: Part Name
  else
    out_stream<< part_name                     << endl;
  out_stream<<"         1         0         0" << endl; // R3: Label, Type, Color

  out_stream<<"Global Cartesian Coordinate System" << endl; // R4: Name
  out_stream<<"    1.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0" << endl;
  out_stream<<"    0.0000000000000000E+0    1.0000000000000000E+0    0.0000000000000000E+0" << endl;
  out_stream<<"    0.0000000000000000E+0    0.0000000000000000E+0    1.0000000000000000E+0" << endl;
  out_stream<<"    0.0000000000000000E+0    0.0000000000000000E+0    0.0000000000000000E+0" << endl;

  out_stream<<"    -1"  << endl;
}