Loading [MathJax]/extensions/tex2jax.js
Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
moab::ReadSmf Class Reference

Read SMF (Simple Model Format) files. More...

#include <ReadSmf.hpp>

+ Inheritance diagram for moab::ReadSmf:
+ Collaboration diagram for moab::ReadSmf:

Classes

struct  cmd_entry
 

Public Types

typedef ErrorCode(ReadSmf::* read_cmd) (std::vector< std::string > &argv)
 

Public Member Functions

ErrorCode load_file (const char *file_name, const EntityHandle *file_set, const FileOptions &opts, const SubsetList *subset_list=0, const Tag *file_id_tag=0)
 load a file More...
 
ErrorCode read_tag_values (const char *file_name, const char *tag_name, const FileOptions &opts, std::vector< int > &tag_values_out, const SubsetList *subset_list=0)
 Read tag values from a file. More...
 
 ReadSmf (Interface *impl=NULL)
 Constructor. More...
 
virtual ~ReadSmf ()
 Destructor. More...
 
void init ()
 
- Public Member Functions inherited from moab::ReaderIface
virtual ~ReaderIface ()
 

Static Public Member Functions

static ReaderIfacefactory (Interface *)
 

Protected Member Functions

ErrorCode annotation (char *cmd, std::vector< std::string > &argv)
 
void bad_annotation (const char *cmd)
 
ErrorCode vertex (std::vector< std::string > &)
 
ErrorCode v_normal (std::vector< std::string > &)
 
ErrorCode v_color (std::vector< std::string > &)
 
ErrorCode f_color (std::vector< std::string > &)
 
ErrorCode face (std::vector< std::string > &)
 
ErrorCode begin (std::vector< std::string > &)
 
ErrorCode end (std::vector< std::string > &)
 
ErrorCode set (std::vector< std::string > &)
 
ErrorCode inc (std::vector< std::string > &)
 
ErrorCode dec (std::vector< std::string > &)
 
ErrorCode trans (std::vector< std::string > &)
 
ErrorCode scale (std::vector< std::string > &)
 
ErrorCode rot (std::vector< std::string > &)
 
ErrorCode mmult (std::vector< std::string > &)
 
ErrorCode mload (std::vector< std::string > &)
 
ErrorCode parse_line (char *line)
 
ErrorCode parse_doubles (int count, const std::vector< std::string > &argv, double results[])
 
ErrorCode parse_mat (const std::vector< std::string > &argv, AffineXform &mat_out)
 
ErrorCode check_length (int count, const std::vector< std::string > &argv)
 

Private Attributes

ReadUtilIfacereadMeshIface
 
InterfacemdbImpl
 interface instance interface instance More...
 
EntityHandle mCurrentMeshHandle
 Meshset Handle for the mesh that is currently being read. More...
 
std::string mPartitionTagName
 A field which, if present and having a single integer for storage, should be used to partition the mesh by range. Defaults to MATERIAL_SET_TAG_NAME. More...
 
char line [SMF_MAXLINE]
 
std::vector< SMF_Statestate
 
SMF_ivars ivar
 
int _numNodes
 
int _numFaces
 
std::vector< double > _coords
 
std::vector< int > _connec
 
int _numNodesInFile
 
int _numElementsInFile
 
size_t lineNo
 
size_t commandNo
 
int versionMajor
 
int versionMinor
 

Static Private Attributes

static cmd_entry read_cmds []
 

Detailed Description

Read SMF (Simple Model Format) files.

File format is documented at: http://people.sc.fsu.edu/~burkardt/data/smf/smf.txt

Definition at line 39 of file ReadSmf.hpp.

Member Typedef Documentation

◆ read_cmd

typedef ErrorCode( ReadSmf::* moab::ReadSmf::read_cmd) (std::vector< std::string > &argv)

Definition at line 64 of file ReadSmf.hpp.

Constructor & Destructor Documentation

◆ ReadSmf()

ReadSmf::ReadSmf ( Interface impl = NULL)

Constructor.

Definition at line 87 of file ReadSmf.cpp.

88  : mdbImpl( impl ), mCurrentMeshHandle( 0 ), lineNo( 0 ), commandNo( 0 ), versionMajor( 0 ), versionMinor( 0 ) 89 { 90  mdbImpl->query_interface( readMeshIface ); 91  ivar.next_vertex = 0; 92  ivar.next_face = 0; 93  _numNodes = _numFaces = 0; 94  _numNodesInFile = _numElementsInFile = 0; 95 }

References _numElementsInFile, _numFaces, _numNodes, _numNodesInFile, ivar, mdbImpl, moab::SMF_ivars::next_face, moab::SMF_ivars::next_vertex, moab::Interface::query_interface(), and readMeshIface.

Referenced by factory().

◆ ~ReadSmf()

ReadSmf::~ReadSmf ( )
virtual

Destructor.

Definition at line 97 of file ReadSmf.cpp.

98 { 99  if( readMeshIface ) 100  { 101  mdbImpl->release_interface( readMeshIface ); 102  readMeshIface = 0; 103  } 104 }

References mdbImpl, readMeshIface, and moab::Interface::release_interface().

Member Function Documentation

◆ annotation()

ErrorCode ReadSmf::annotation ( char *  cmd,
std::vector< std::string > &  argv 
)
protected

Definition at line 208 of file ReadSmf.cpp.

209 { 210  // Skip over the '#$' prefix 211  cmd += 2; 212  213  if( streq( cmd, "SMF" ) ) 214  { 215  // If SMF version is specified, it must be the first 216  // thing specified in the file. 217  if( commandNo > 1 ) 218  { 219  MB_SET_ERR( MB_FILE_WRITE_ERROR, "SMF file version specified at line " << lineNo ); 220  } 221  222  if( 2 == sscanf( argv[0].c_str(), "%d.%d", &versionMajor, &versionMinor ) ) 223  { 224  if( versionMajor != 1 || versionMinor != 0 ) 225  { 226  MB_SET_ERR( MB_FILE_WRITE_ERROR, 227  "Unsupported SMF file version: " << versionMajor << "." << versionMinor ); 228  } 229  } 230  else 231  { 232  MB_SET_ERR( MB_FILE_WRITE_ERROR, "Invalid SMF version annotation" ); 233  } 234  } 235  else if( streq( cmd, "vertices" ) ) 236  { 237  if( argv.size() == 1 ) 238  _numNodes = atoi( argv[0].c_str() ); 239  else 240  bad_annotation( cmd ); 241  } 242  else if( streq( cmd, "faces" ) ) 243  { 244  if( argv.size() == 1 ) 245  _numFaces = atoi( argv[0].c_str() ); 246  else 247  bad_annotation( cmd ); 248  } 249  else if( streq( cmd, "BBox" ) ) 250  { 251  } 252  else if( streq( cmd, "BSphere" ) ) 253  { 254  } 255  else if( streq( cmd, "PXform" ) ) 256  { 257  if( argv.size() == 16 ) 258  { 259  // parse_mat(argv); 260  } 261  else 262  bad_annotation( cmd ); 263  } 264  else if( streq( cmd, "MXform" ) ) 265  { 266  if( argv.size() == 16 ) 267  { 268  // parse_mat(argv); 269  } 270  else 271  bad_annotation( cmd ); 272  } 273  274  return MB_SUCCESS; 275 }

References _numFaces, _numNodes, bad_annotation(), commandNo, lineNo, MB_FILE_WRITE_ERROR, MB_SET_ERR, MB_SUCCESS, streq(), versionMajor, and versionMinor.

Referenced by parse_line().

◆ bad_annotation()

void ReadSmf::bad_annotation ( const char *  cmd)
protected

Definition at line 77 of file ReadSmf.cpp.

78 { 79  std::cerr << "SMF: Malformed annotation [" << cmd << "]" << std::endl; 80 }

Referenced by annotation().

◆ begin()

ErrorCode ReadSmf::begin ( std::vector< std::string > &  )
protected

Definition at line 424 of file ReadSmf.cpp.

425 { 426  state.push_back( SMF_State( ivar, &state.back() ) ); 427  428  return MB_SUCCESS; 429 }

References ivar, MB_SUCCESS, and state.

◆ check_length()

ErrorCode ReadSmf::check_length ( int  count,
const std::vector< std::string > &  argv 
)
protected

Definition at line 341 of file ReadSmf.cpp.

342 { 343  if( ( argv.size() < (unsigned)count ) || ( argv.size() > (unsigned)count && argv[count][0] != '#' ) ) 344  { 345  MB_SET_ERR( MB_FILE_WRITE_ERROR, "Expect " << count << " arguments at line " << lineNo ); 346  } 347  348  return MB_SUCCESS; 349 }

References lineNo, MB_FILE_WRITE_ERROR, MB_SET_ERR, and MB_SUCCESS.

Referenced by face(), parse_doubles(), and rot().

◆ dec()

ErrorCode ReadSmf::dec ( std::vector< std::string > &  )
protected

Definition at line 468 of file ReadSmf.cpp.

469 { 470  // std::cerr << "SMF: DEC not yet implemented." << std::endl; 471  return MB_SUCCESS; 472 }

References MB_SUCCESS.

◆ end()

ErrorCode ReadSmf::end ( std::vector< std::string > &  )
protected

Definition at line 431 of file ReadSmf.cpp.

432 { 433  // There must always be at least one state on the stack. 434  // Don't let mismatched begin/end statements cause us 435  // to read from an empty vector. 436  if( state.size() == 1 ) 437  { 438  MB_SET_ERR( MB_FILE_WRITE_ERROR, "End w/out Begin at line " << lineNo ); 439  } 440  441  state.pop_back(); 442  443  return MB_SUCCESS; 444 }

References lineNo, MB_FILE_WRITE_ERROR, MB_SET_ERR, MB_SUCCESS, and state.

◆ f_color()

ErrorCode ReadSmf::f_color ( std::vector< std::string > &  )
protected

Definition at line 394 of file ReadSmf.cpp.

395 { 396  return MB_SUCCESS; 397 }

References MB_SUCCESS.

◆ face()

ErrorCode ReadSmf::face ( std::vector< std::string > &  argv)
protected

Definition at line 399 of file ReadSmf.cpp.

400 { 401  ErrorCode err = check_length( 3, argv ); 402  if( MB_SUCCESS != err ) return err; 403  404  int vert[3] = {}; 405  char* endptr; 406  for( unsigned int i = 0; i < argv.size(); i++ ) 407  { 408  vert[i] = strtol( argv[i].c_str(), &endptr, 0 ); 409  if( *endptr ) 410  { 411  MB_SET_ERR( MB_FILE_WRITE_ERROR, "Invalid face spec at line " << lineNo ); 412  } 413  } 414  415  state.back().face( vert, ivar ); 416  ivar.next_face++; 417  for( int j = 0; j < 3; j++ ) 418  _connec.push_back( vert[j] ); 419  _numElementsInFile++; 420  421  return MB_SUCCESS; 422 }

References _connec, _numElementsInFile, check_length(), ErrorCode, ivar, lineNo, MB_FILE_WRITE_ERROR, MB_SET_ERR, MB_SUCCESS, moab::SMF_ivars::next_face, and state.

◆ factory()

ReaderIface * ReadSmf::factory ( Interface iface)
static

Definition at line 82 of file ReadSmf.cpp.

83 { 84  return new ReadSmf( iface ); 85 }

References iface, and ReadSmf().

Referenced by moab::ReaderWriterSet::ReaderWriterSet().

◆ inc()

ErrorCode ReadSmf::inc ( std::vector< std::string > &  )
protected

Definition at line 462 of file ReadSmf.cpp.

463 { 464  // std::cerr << "SMF: INC not yet implemented." << std::endl; 465  return MB_SUCCESS; 466 }

References MB_SUCCESS.

◆ init()

void moab::ReadSmf::init ( )

◆ load_file()

ErrorCode ReadSmf::load_file ( const char *  file_name,
const EntityHandle file_set,
const FileOptions opts,
const SubsetList subset_list = 0,
const Tag file_id_tag = 0 
)
virtual

load a file

Implements moab::ReaderIface.

Definition at line 115 of file ReadSmf.cpp.

120 { 121  ErrorCode result; 122  lineNo = 0; 123  commandNo = 0; 124  versionMajor = 0; 125  versionMinor = 0; 126  127  if( subset_list ) 128  { 129  MB_SET_ERR( MB_UNSUPPORTED_OPERATION, "Reading subset of files not supported for VTK" ); 130  } 131  132  // Does the caller want a field to be used for partitioning the entities? 133  // If not, we'll assume any scalar integer field named MATERIAL_SET specifies partitions. 134  std::string partition_tag_name; 135  result = opts.get_option( "PARTITION", partition_tag_name ); 136  if( result == MB_SUCCESS ) mPartitionTagName = partition_tag_name; 137  138  std::ifstream smfFile( filename ); 139  if( !smfFile ) return MB_FILE_DOES_NOT_EXIST; 140  141  ivar.next_face = 1; 142  ivar.next_vertex = 1; 143  state.push_back( SMF_State( ivar ) ); 144  145  while( smfFile.getline( line, SMF_MAXLINE, '\n' ).good() ) 146  { 147  ++lineNo; 148  result = parse_line( line ); 149  if( MB_SUCCESS != result ) return result; 150  } 151  152  if( !smfFile.eof() ) 153  { 154  // Parsing terminated for a reason other than EOF: signal failure. 155  return MB_FILE_WRITE_ERROR; 156  } 157  158  // At this point we have _numNodesInFile vertices and _numElementsInFile triangles 159  // the coordinates are in _coords, and connectivities in _connec 160  // std::vector<double> _coords; // 3*numNodes; we might not know the number of nodes 161  // std::vector<int> _connec; // 3*num of elements; we might not know them; 162  163  // Create vertices 164  std::vector< double* > arrays; 165  EntityHandle start_handle_out; 166  start_handle_out = 0; 167  result = readMeshIface->get_node_coords( 3, _numNodesInFile, MB_START_ID, start_handle_out, arrays ); 168  169  if( MB_SUCCESS != result ) return result; 170  171  // Fill the arrays with data from _coords 172  // Cppcheck warning (false positive): variable arrays is assigned a value that is never used 173  for( int i = 0; i < _numNodesInFile; i++ ) 174  { 175  int i3 = 3 * i; 176  arrays[0][i] = _coords[i3]; 177  arrays[1][i] = _coords[i3 + 1]; 178  arrays[2][i] = _coords[i3 + 2]; 179  } 180  // Elements 181  182  EntityHandle start_handle_elem_out; 183  start_handle_elem_out = 0; 184  EntityHandle* conn_array_out; 185  result = readMeshIface->get_element_connect( _numElementsInFile, 3, 186  MBTRI, // EntityType 187  MB_START_ID, start_handle_elem_out, conn_array_out ); 188  if( MB_SUCCESS != result ) return result; 189  for( int j = 0; j < _numElementsInFile * 3; j++ ) 190  conn_array_out[j] = _connec[j]; 191  192  // Notify MOAB of the new elements 193  result = readMeshIface->update_adjacencies( start_handle_elem_out, _numElementsInFile, 3, conn_array_out ); 194  195  if( MB_SUCCESS != result ) return result; 196  197  if( file_id_tag ) 198  { 199  Range nodes( start_handle_out, start_handle_out + _numNodesInFile - 1 ); 200  Range elems( start_handle_elem_out, start_handle_elem_out + _numElementsInFile - 1 ); 201  readMeshIface->assign_ids( *file_id_tag, nodes ); 202  readMeshIface->assign_ids( *file_id_tag, elems ); 203  } 204  205  return MB_SUCCESS; 206 }

References _connec, _coords, _numElementsInFile, _numNodesInFile, moab::ReadUtilIface::assign_ids(), commandNo, ErrorCode, moab::ReadUtilIface::get_element_connect(), moab::ReadUtilIface::get_node_coords(), moab::FileOptions::get_option(), ivar, line, lineNo, MB_FILE_DOES_NOT_EXIST, MB_FILE_WRITE_ERROR, MB_SET_ERR, MB_START_ID, MB_SUCCESS, MB_UNSUPPORTED_OPERATION, MBTRI, mPartitionTagName, moab::SMF_ivars::next_face, moab::SMF_ivars::next_vertex, parse_line(), readMeshIface, SMF_MAXLINE, state, moab::ReadUtilIface::update_adjacencies(), versionMajor, and versionMinor.

◆ mload()

ErrorCode ReadSmf::mload ( std::vector< std::string > &  argv)
protected

Definition at line 549 of file ReadSmf.cpp.

550 { 551  AffineXform mat; 552  ErrorCode rval = parse_mat( argv, mat ); 553  if( MB_SUCCESS != rval ) return rval; 554  555  state.back().mload( mat ); 556  557  return MB_SUCCESS; 558 }

References ErrorCode, MB_SUCCESS, parse_mat(), and state.

◆ mmult()

ErrorCode ReadSmf::mmult ( std::vector< std::string > &  argv)
protected

Definition at line 538 of file ReadSmf.cpp.

539 { 540  AffineXform mat; 541  ErrorCode rval = parse_mat( argv, mat ); 542  if( MB_SUCCESS != rval ) return rval; 543  544  state.back().mmult( mat ); 545  546  return MB_SUCCESS; 547 }

References ErrorCode, MB_SUCCESS, parse_mat(), and state.

◆ parse_doubles()

ErrorCode ReadSmf::parse_doubles ( int  count,
const std::vector< std::string > &  argv,
double  results[] 
)
protected

Definition at line 351 of file ReadSmf.cpp.

352 { 353  ErrorCode rval = check_length( count, argv ); 354  if( MB_SUCCESS != rval ) return rval; 355  356  char* endptr; 357  for( int i = 0; i < count; i++ ) 358  { 359  results[i] = strtod( argv[i].c_str(), &endptr ); 360  if( *endptr ) 361  { 362  MB_SET_ERR( MB_FILE_WRITE_ERROR, "Invalid vertex coordinates at line " << lineNo ); 363  } 364  } 365  366  return MB_SUCCESS; 367 }

References check_length(), ErrorCode, lineNo, MB_FILE_WRITE_ERROR, MB_SET_ERR, and MB_SUCCESS.

Referenced by parse_mat(), rot(), scale(), trans(), and vertex().

◆ parse_line()

ErrorCode ReadSmf::parse_line ( char *  line)
protected

Definition at line 277 of file ReadSmf.cpp.

278 { 279  char *cmd, *s; 280  std::vector< std::string > argv; 281  ErrorCode err; 282  283  while( *ln == ' ' || *ln == '\t' ) 284  ln++; // Skip initial white space 285  286  // Ignore empty lines 287  if( ln[0] == '\n' || ln[0] == '\0' ) return MB_SUCCESS; 288  289  // Ignore comments 290  if( ln[0] == '#' && ln[1] != '$' ) return MB_SUCCESS; 291  292  // First, split the line into tokens 293  cmd = strtok( ln, " \t\n" ); 294  295  while( ( s = strtok( NULL, " \t\n" ) ) ) 296  { 297  std::string stg( s ); 298  argv.push_back( stg ); 299  } 300  301  // Figure out what command it is and execute it 302  if( cmd[0] == '#' && cmd[1] == '$' ) 303  { 304  err = annotation( cmd, argv ); 305  if( MB_SUCCESS != err ) return err; 306  } 307  else 308  { 309  cmd_entry* entry = &read_cmds[0]; 310  bool handled = false; 311  312  while( entry->name && !handled ) 313  { 314  if( streq( entry->name, cmd ) ) 315  { 316  err = ( this->*( entry->cmd ) )( argv ); 317  if( MB_SUCCESS != err ) return err; 318  handled = true; 319  ++commandNo; 320  } 321  else 322  entry++; 323  } 324  325  if( !handled ) 326  { 327  // If the first command was invalid, this probably 328  // wasn't an Smf file. Fail silently in this case. 329  // If versionMajor is set, then we saw an initial #$SMF, 330  // in which case it must be a SMF file. 331  if( !versionMajor && !commandNo ) return MB_FILE_WRITE_ERROR; 332  333  // Invalid command: 334  MB_SET_ERR( MB_UNSUPPORTED_OPERATION, "Illegal SMF command at line " << lineNo << ": \"" << cmd << "\"" ); 335  } 336  } 337  338  return MB_SUCCESS; 339 }

References annotation(), moab::ReadSmf::cmd_entry::cmd, commandNo, ErrorCode, lineNo, MB_FILE_WRITE_ERROR, MB_SET_ERR, MB_SUCCESS, MB_UNSUPPORTED_OPERATION, moab::ReadSmf::cmd_entry::name, read_cmds, streq(), and versionMajor.

Referenced by load_file().

◆ parse_mat()

ErrorCode ReadSmf::parse_mat ( const std::vector< std::string > &  argv,
AffineXform mat_out 
)
protected

Definition at line 67 of file ReadSmf.cpp.

68 { 69  double values[12]; 70  ErrorCode err = parse_doubles( 12, argv, values ); 71  if( MB_SUCCESS != err ) return err; 72  73  mat = AffineXform( values, values + 9 ); 74  return MB_SUCCESS; 75 }

References ErrorCode, MB_SUCCESS, and parse_doubles().

Referenced by mload(), and mmult().

◆ read_tag_values()

ErrorCode ReadSmf::read_tag_values ( const char *  file_name,
const char *  tag_name,
const FileOptions opts,
std::vector< int > &  tag_values_out,
const SubsetList subset_list = 0 
)
virtual

Read tag values from a file.

Read the list if all integer tag values from the file for a tag that is a single integer value per entity.

Parameters
file_nameThe file to read.
tag_nameThe tag for which to read values
tag_values_outOutput: The list of tag values.
subset_listAn array of tag name and value sets specifying the subset of the file to read. If multiple tags are specified, the sets that match all tags (intersection) should be read.
subset_list_lengthThe length of the 'subset_list' array.

Implements moab::ReaderIface.

Definition at line 106 of file ReadSmf.cpp.

111 { 112  return MB_NOT_IMPLEMENTED; 113 }

References MB_NOT_IMPLEMENTED.

◆ rot()

ErrorCode ReadSmf::rot ( std::vector< std::string > &  argv)
protected

Definition at line 500 of file ReadSmf.cpp.

501 { 502  ErrorCode err = check_length( 2, argv ); 503  if( MB_SUCCESS != err ) return err; 504  505  double axis[3] = { 0., 0., 0. }; 506  std::string axisname = argv.front(); 507  argv.erase( argv.begin() ); 508  if( axisname.size() != 1 ) 509  { 510  MB_SET_ERR( MB_FILE_WRITE_ERROR, "Malformed rotation command at line " << lineNo ); 511  } 512  switch( axisname[0] ) 513  { 514  case 'x': 515  axis[0] = 1.; 516  break; 517  case 'y': 518  axis[1] = 1.; 519  break; 520  case 'z': 521  axis[2] = 1.; 522  break; 523  default: 524  MB_SET_ERR( MB_FILE_WRITE_ERROR, "Malformed rotation command at line " << lineNo ); 525  } 526  527  double angle; 528  err = parse_doubles( 1, argv, &angle ); 529  if( MB_SUCCESS != err ) return err; 530  angle *= M_PI / 180.0; 531  532  AffineXform M = AffineXform::rotation( angle, axis ); 533  state.back().mmult( M ); 534  535  return MB_SUCCESS; 536 }

References moab::angle(), check_length(), ErrorCode, lineNo, MB_FILE_WRITE_ERROR, MB_SET_ERR, MB_SUCCESS, parse_doubles(), moab::AffineXform::rotation(), and state.

◆ scale()

ErrorCode ReadSmf::scale ( std::vector< std::string > &  argv)
protected

Definition at line 487 of file ReadSmf.cpp.

488 { 489  double v3[3]; 490  ErrorCode err = parse_doubles( 3, argv, v3 ); 491  if( MB_SUCCESS != err ) return err; 492  493  AffineXform M = AffineXform::scale( v3 ); 494  // Mat4 M = Mat4::scale(atof(argv(0)), atof(argv(1)), atof(argv(2))); 495  state.back().mmult( M ); 496  497  return MB_SUCCESS; 498 }

References ErrorCode, MB_SUCCESS, parse_doubles(), moab::AffineXform::scale(), and state.

◆ set()

ErrorCode ReadSmf::set ( std::vector< std::string > &  argv)
protected

Definition at line 446 of file ReadSmf.cpp.

447 { 448  if( argv.size() < 2 || argv[0] != "vertex_coorection" ) return MB_SUCCESS; 449  450  char* endptr; 451  int val = strtol( argv[1].c_str(), &endptr, 0 ); 452  if( *endptr ) 453  { 454  MB_SET_ERR( MB_FILE_WRITE_ERROR, "Invalid value at line " << lineNo ); 455  } 456  457  state.back().set_vertex_correction( val ); 458  459  return MB_SUCCESS; 460 }

References lineNo, MB_FILE_WRITE_ERROR, MB_SET_ERR, MB_SUCCESS, and state.

◆ trans()

ErrorCode ReadSmf::trans ( std::vector< std::string > &  argv)
protected

Definition at line 474 of file ReadSmf.cpp.

475 { 476  double v3[3]; 477  ErrorCode err = parse_doubles( 3, argv, v3 ); 478  if( MB_SUCCESS != err ) return err; 479  480  AffineXform M = AffineXform::translation( v3 ); 481  // Mat4 M = Mat4::trans(atof(argv(0)), atof(argv(1)), atof(argv(2))); 482  state.back().mmult( M ); 483  484  return MB_SUCCESS; 485 }

References ErrorCode, MB_SUCCESS, parse_doubles(), state, and moab::AffineXform::translation().

◆ v_color()

ErrorCode ReadSmf::v_color ( std::vector< std::string > &  )
protected

Definition at line 389 of file ReadSmf.cpp.

390 { 391  return MB_SUCCESS; 392 }

References MB_SUCCESS.

◆ v_normal()

ErrorCode ReadSmf::v_normal ( std::vector< std::string > &  )
protected

Definition at line 384 of file ReadSmf.cpp.

385 { 386  return MB_SUCCESS; 387 }

References MB_SUCCESS.

◆ vertex()

ErrorCode ReadSmf::vertex ( std::vector< std::string > &  argv)
protected

Definition at line 369 of file ReadSmf.cpp.

370 { 371  double v[3]; 372  ErrorCode err = parse_doubles( 3, argv, v ); 373  if( MB_SUCCESS != err ) return err; 374  375  state.back().vertex( v ); 376  ivar.next_vertex++; 377  _numNodesInFile++; 378  for( int j = 0; j < 3; j++ ) 379  _coords.push_back( v[j] ); 380  // model->in_Vertex(v); 381  return MB_SUCCESS; 382 }

References _coords, _numNodesInFile, ErrorCode, ivar, MB_SUCCESS, moab::SMF_ivars::next_vertex, parse_doubles(), and state.

Member Data Documentation

◆ _connec

std::vector< int > moab::ReadSmf::_connec
private

Definition at line 124 of file ReadSmf.hpp.

Referenced by face(), and load_file().

◆ _coords

std::vector< double > moab::ReadSmf::_coords
private

Definition at line 123 of file ReadSmf.hpp.

Referenced by load_file(), and vertex().

◆ _numElementsInFile

int moab::ReadSmf::_numElementsInFile
private

Definition at line 126 of file ReadSmf.hpp.

Referenced by face(), load_file(), and ReadSmf().

◆ _numFaces

int moab::ReadSmf::_numFaces
private

Definition at line 122 of file ReadSmf.hpp.

Referenced by annotation(), and ReadSmf().

◆ _numNodes

int moab::ReadSmf::_numNodes
private

Definition at line 121 of file ReadSmf.hpp.

Referenced by annotation(), and ReadSmf().

◆ _numNodesInFile

int moab::ReadSmf::_numNodesInFile
private

Definition at line 125 of file ReadSmf.hpp.

Referenced by load_file(), ReadSmf(), and vertex().

◆ commandNo

size_t moab::ReadSmf::commandNo
private

Definition at line 128 of file ReadSmf.hpp.

Referenced by annotation(), load_file(), and parse_line().

◆ ivar

SMF_ivars moab::ReadSmf::ivar
private

Definition at line 120 of file ReadSmf.hpp.

Referenced by begin(), face(), load_file(), ReadSmf(), and vertex().

◆ line

char moab::ReadSmf::line[SMF_MAXLINE]
private

Definition at line 118 of file ReadSmf.hpp.

Referenced by load_file().

◆ lineNo

size_t moab::ReadSmf::lineNo
private

Definition at line 127 of file ReadSmf.hpp.

Referenced by annotation(), check_length(), end(), face(), load_file(), parse_doubles(), parse_line(), rot(), and set().

◆ mCurrentMeshHandle

EntityHandle moab::ReadSmf::mCurrentMeshHandle
private

Meshset Handle for the mesh that is currently being read.

Definition at line 110 of file ReadSmf.hpp.

◆ mdbImpl

Interface* moab::ReadSmf::mdbImpl
private

interface instance interface instance

Definition at line 107 of file ReadSmf.hpp.

Referenced by ReadSmf(), and ~ReadSmf().

◆ mPartitionTagName

std::string moab::ReadSmf::mPartitionTagName
private

A field which, if present and having a single integer for storage, should be used to partition the mesh by range. Defaults to MATERIAL_SET_TAG_NAME.

Definition at line 114 of file ReadSmf.hpp.

Referenced by load_file().

◆ read_cmds

ReadSmf::cmd_entry ReadSmf::read_cmds
staticprivate
Initial value:
= { { "v", &ReadSmf::vertex }, { ":vn", &ReadSmf::v_normal }, { ":vc", &ReadSmf::v_color }, { ":fc", &ReadSmf::f_color }, { "t", &ReadSmf::face }, { "f", &ReadSmf::face }, { "begin", &ReadSmf::begin }, { "end", &ReadSmf::end }, { "set", &ReadSmf::set }, { "inc", &ReadSmf::inc }, { "dec", &ReadSmf::dec }, { "mmult", &ReadSmf::mload }, { "mload", &ReadSmf::mmult }, { "trans", &ReadSmf::trans }, { "scale", &ReadSmf::scale }, { "rot", &ReadSmf::rot }, { NULL, NULL } }

Definition at line 117 of file ReadSmf.hpp.

Referenced by parse_line().

◆ readMeshIface

ReadUtilIface* moab::ReadSmf::readMeshIface
private

Definition at line 101 of file ReadSmf.hpp.

Referenced by load_file(), ReadSmf(), and ~ReadSmf().

◆ state

std::vector< SMF_State > moab::ReadSmf::state
private

Definition at line 119 of file ReadSmf.hpp.

Referenced by begin(), end(), face(), load_file(), mload(), mmult(), rot(), scale(), set(), trans(), and vertex().

◆ versionMajor

int moab::ReadSmf::versionMajor
private

Definition at line 129 of file ReadSmf.hpp.

Referenced by annotation(), load_file(), and parse_line().

◆ versionMinor

int moab::ReadSmf::versionMinor
private

Definition at line 129 of file ReadSmf.hpp.

Referenced by annotation(), and load_file().


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