Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Element.cpp File Reference
#include "Element.hpp"
#include "HexElement.hpp"
#include "TetElement.hpp"
#include "TCoElement.hpp"
#include "QCoElement.hpp"
#include "Node.hpp"
#include "Face.hpp"
#include "Mesh.hpp"
#include <assert.h>
#include <math.h>
Include dependency graph for Element.cpp:

Go to the source code of this file.

Functions

istream & operator>> (istream &stream, Element &elem)
 
ostream & operator<< (ostream &stream, Element &elem)
 

Function Documentation

ostream& operator<< ( ostream &  stream,
Element elem 
)

Definition at line 91 of file Element.cpp.

References Element::d_eType, Element::d_ID, Element::d_materialType, Element::d_nodes, Node::getID(), Element::getNumNodes(), and i.

91  {
92 
93  stream << elem.d_ID << '\t' << elem.d_eType << '\t' << elem.d_materialType;
94 
95  // write nodes out to file.
96 
97  //OK, we have to special-case the cohesive elements due to
98  //the strange way that they are supposed to be output. So,
99  //the tet-cohesive element needs to have 1-2-3 as usual, but then "4" should be
100  //the node that matches up with node 3, instead of node 1. Thus, since
101  //the elements are stored 1-2-3 4-5-6, with 4 matched with 1, 5 matched
102  //with 2, etc., we have to output 1-2-3-6-4-5. Similarly, for the
103  //quad cohesive, we output 1-2-3-4-8-5-6-7.
104  switch(elem.d_eType) {
105  case 2: //e_tri_cohesive
106  stream << '\t' << elem.d_nodes[0]->getID();
107  stream << '\t' << elem.d_nodes[1]->getID();
108  stream << '\t' << elem.d_nodes[2]->getID();
109  stream << '\t' << elem.d_nodes[5]->getID();
110  stream << '\t' << elem.d_nodes[3]->getID();
111  stream << '\t' << elem.d_nodes[4]->getID();
112  stream << endl;
113  break;
114  case 3: //e_quad_cohesive
115  stream << '\t' << elem.d_nodes[0]->getID();
116  stream << '\t' << elem.d_nodes[1]->getID();
117  stream << '\t' << elem.d_nodes[2]->getID();
118  stream << '\t' << elem.d_nodes[3]->getID();
119  stream << '\t' << elem.d_nodes[7]->getID();
120  stream << '\t' << elem.d_nodes[4]->getID();
121  stream << '\t' << elem.d_nodes[5]->getID();
122  stream << '\t' << elem.d_nodes[6]->getID();
123  stream << endl;
124  break;
125  default:
126  //put out in the order it's stored in the d_nodes array.
127  //default for normal tet and brick elements.
128  int numn = elem.getNumNodes();
129  int i;
130  for( i = 0; i < numn; i++ ){
131  stream << '\t' << elem.d_nodes[i]->getID();
132  }
133  stream << endl;
134  }
135  return stream;
136 }
virtual int getNumNodes() const =0
int d_ID
Definition: Element.hpp:84
Type d_eType
Definition: Element.hpp:82
int getID()
Definition: Node.hpp:119
Node ** d_nodes
Definition: Element.hpp:86
blockLoc i
Definition: read.cpp:79
int d_materialType
Definition: Element.hpp:89

Here is the call graph for this function:

istream& operator>> ( istream &  stream,
Element elem 
)

Definition at line 70 of file Element.cpp.

References Node::addElement(), Element::d_materialType, Element::d_nodes, Mesh::getNode(), Element::getNumNodes(), i, Element::s_mesh, and Element::setFromMyNodes().

70  {
71 
72  // read material
73  stream >> elem.d_materialType;
74 
75  // read nodes & set
76 
77  int numn = elem.getNumNodes();
78  int i;
79  for( i = 0; i < numn; i++ ){
80  int node_id;
81  stream >> node_id;
82  Node *node = elem.s_mesh->getNode(node_id);
83  elem.d_nodes[i] = node;
84  node->addElement( &elem );
85  }
86  elem.setFromMyNodes();
87  return stream;
88 
89 }
virtual int getNumNodes() const =0
This class encapsulate a node over a window manifold.
Definition: Manifold_2.h:370
Node ** d_nodes
Definition: Element.hpp:86
Definition: adj.h:150
virtual void setFromMyNodes()=0
blockLoc i
Definition: read.cpp:79
Node * getNode(int ID)
The following get methods return a node, face or element.
Definition: Mesh.hpp:137
static Mesh * s_mesh
Definition: Element.hpp:91
void addElement(Element *elem)
Definition: Node.cpp:86
int d_materialType
Definition: Element.hpp:89

Here is the call graph for this function: