Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tpz_fequad Class Reference

#include <partition.h>

Inheritance diagram for tpz_fequad:
Collaboration diagram for tpz_fequad:

Public Member Functions

 tpz_fequad (string *zheader, string *zdata)
 
void build_point_index ()
 
 ~tpz_fequad ()
 
virtual void parse_layout ()
 
virtual bool parse_data (int num_dep_vars, int num_vars, std::vector< std::vector< int > > rFieldMappings, index_order rIndexOrder, std::vector< adj_map > conv_factor, std::vector< adj_map > norm_val)
 
- Public Member Functions inherited from tpzone
 tpzone (string *zheader, string *zdata)
 
virtual ~tpzone ()
 
- Public Member Functions inherited from partition
 partition ()
 
virtual ~partition ()
 
std::vector< int > get_layout ()
 
string get_error ()
 
string get_status ()
 
int get_num_points ()
 
pointsget_points ()
 
pnt get_point (int n)
 

Private Attributes

connect_pointsdata_pts_local
 

Additional Inherited Members

- Protected Member Functions inherited from partition
long double get_adj (std::vector< adj_map > adj, int var)
 
int GetFieldMapping (std::vector< std::vector< int > > rFieldMapping, int rSearchField)
 
- Protected Attributes inherited from tpzone
string * zheader
 
string * zdata
 
- Protected Attributes inherited from partition
std::vector< int > p_layout
 
string error
 
string status
 
pointsdata_pts
 
bool data_pts_set
 

Detailed Description

Definition at line 103 of file partition.h.

Constructor & Destructor Documentation

tpz_fequad ( string *  zheader,
string *  zdata 
)

Definition at line 346 of file partition.cpp.

References partition::data_pts, data_pts_local, and partition::data_pts_set.

346  : tpzone(zheader, zdata){
349 
350  data_pts_set = true;
351 }
bool data_pts_set
Definition: partition.h:54
string * zdata
Definition: partition.h:75
tpzone(string *zheader, string *zdata)
Definition: partition.cpp:85
connect_points * data_pts_local
Definition: partition.h:119
points * data_pts
Definition: partition.h:53
string * zheader
Definition: partition.h:74
~tpz_fequad ( )

Definition at line 353 of file partition.cpp.

353  {
354  return;
355 }

Member Function Documentation

void build_point_index ( )
bool parse_data ( int  num_dep_vars,
int  num_vars,
std::vector< std::vector< int > >  rFieldMappings,
index_order  rIndexOrder,
std::vector< adj_map conv_factor,
std::vector< adj_map norm_val 
)
virtual

Reimplemented from partition.

Definition at line 398 of file partition.cpp.

References partition::data_pts, data_pts_local, partition::get_adj(), partition::GetFieldMapping(), i, itoa(), Mesquite::length(), n, nvc::norm(), partition::p_layout, read(), connect_points::set_connectivity(), points::set_num_indep_vars(), points::set_num_points(), points::set_num_vars(), points::set_point_val(), partition::status, and tpzone::zdata.

400  {
401 
402  std::stringstream data(std::stringstream::in | std::stringstream::out);
403  data << *zdata;
404 
405  int length = 1;
406  for(int i=0; i < (num_vars - num_dep_vars); i++){
407  if(i >= p_layout.size())
408  break;
409 
410  length *= p_layout[i];
411  }
412 
413  //Initialize storage
414  data_pts->set_num_points(length);
415  data_pts->set_num_vars(num_vars);
416  data_pts->set_num_indep_vars(num_vars - num_dep_vars);
417 
418  //Read Data
419  string out;
420 
421  for(int n=0; n<num_vars; n++){
422 
423  long double conv = get_adj(conv_factor, n);
424  long double norm = get_adj(norm_val, n);
425 
426  //Get variable number from mapping
427  int var_location = GetFieldMapping(rFieldMappings, n);
428 
429  for(int i=0; i<length; i++){
430 
431  data >> out;
432 
433  //Skip saving the point if the dimension is mapped to null
434  if(var_location < 0)
435  continue;
436 
437  long double read = strtold(out.c_str(), NULL);
438 
439  //Apply conversion and normalization factors
440  read = read * conv * norm;
441 
442  //Store point value
443  data_pts->set_point_val(i, var_location, read);
444  }
445  }
446 
447  //Read Connectivity Information
448  int first, sec, third, fourth;
449  first = 0;
450  sec = 0;
451  third = 0;
452  fourth = 0;
453 
454  //Read 4 values
455  data >> first >> sec >> third >> fourth;
456 
457  while(!data.eof()){
458 
459  data_pts_local->set_connectivity(first, sec);
460  data_pts_local->set_connectivity(first, fourth);
461 
462  data_pts_local->set_connectivity(sec, third);
463  data_pts_local->set_connectivity(sec, first);
464 
465  data_pts_local->set_connectivity(third, fourth);
466  data_pts_local->set_connectivity(third, sec);
467 
468  data_pts_local->set_connectivity(fourth, first);
469  data_pts_local->set_connectivity(fourth, third);
470 
471  first = 0;
472  sec = 0;
473  third = 0;
474  fourth = 0;
475  data >> first >> sec >> third >> fourth;
476  }
477 
478 
479  //Set Status
480  string zs_out("Extracted ");
481  zs_out += itoa(length) + " datapoints";
482  status = zs_out;
483 
484  return true;
485 }
string * zdata
Definition: partition.h:75
void set_num_indep_vars(int indep_vars)
Definition: points.cpp:113
std::vector< int > p_layout
Definition: partition.h:46
T norm(const NVec< DIM, T > &v)
void set_point_val(int point_number, int var, long double val)
Definition: points.cpp:129
double length(Vector3D *const v, int n)
void set_num_points(int n)
Definition: points.cpp:84
string itoa(int n)
Convert an int to a string.
int GetFieldMapping(std::vector< std::vector< int > > rFieldMapping, int rSearchField)
Definition: partition.cpp:70
blockLoc i
Definition: read.cpp:79
connect_points * data_pts_local
Definition: partition.h:119
points * data_pts
Definition: partition.h:53
const NT & n
string status
Definition: partition.h:50
void set_connectivity(int point_num, int c_point)
Definition: points.cpp:321
long double get_adj(std::vector< adj_map > adj, int var)
Definition: partition.cpp:61
void read(std::istream &is, T &t, const io_Read_write &)
Definition: io.h:132
void set_num_vars(int n)
Definition: points.cpp:109

Here is the call graph for this function:

void parse_layout ( )
virtual

Reimplemented from partition.

Definition at line 357 of file partition.cpp.

References check_non_numeric_str(), partition::error, itoa(), partition::p_layout, readCommaExpression(), partition::status, and tpzone::zheader.

357  {
358 
359  int nodes = 0;
360  int elements = 0;
361 
362  //Parse number of nodes
363  std::vector<string> nodes_str = readCommaExpression( *zheader, string("Nodes") );
364 
365  if(nodes_str.size() == 1){
366  if( !check_non_numeric_str(string(nodes_str[0])) )
367  nodes = atoi(nodes_str[0].c_str());
368  }
369  else{
370  error = string("Unable to read Nodes value from zone header");
371 
372  return;
373  }
374 
375  //Parse number of elements
376  std::vector<string> elements_str = readCommaExpression( *zheader, string("Elements") );
377 
378  if(elements_str.size() == 1){
379  if( !check_non_numeric_str(string(elements_str[0])) )
380  elements = atoi(elements_str[0].c_str());
381  }
382  else{
383  error = string("Unable to read Elements value from zone header");
384 
385  return;
386  }
387 
388  //Set Status
389  status = string("Nodes = ") + itoa(nodes) + string(", Elements = ") + itoa(elements);
390 
391  p_layout.erase(p_layout.begin(), p_layout.end());
392  p_layout.push_back(nodes);
393 
394 }
std::vector< int > p_layout
Definition: partition.h:46
string error
Definition: partition.h:49
std::vector< string > readCommaExpression(string rStack, string rNeedle)
string itoa(int n)
Convert an int to a string.
string status
Definition: partition.h:50
string * zheader
Definition: partition.h:74
bool check_non_numeric_str(string test_str)

Here is the call graph for this function:

Member Data Documentation

connect_points* data_pts_local
private

Definition at line 119 of file partition.h.

Referenced by parse_data(), and tpz_fequad().


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