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

#include <Element.hpp>

Inheritance diagram for Element:
Collaboration diagram for Element:

Public Types

enum  Type {
  e_tet, e_hex, e_tri_cohesive, e_quad_cohesive,
  e_MAX_TYPE
}
 
enum  fType { e_tri, e_quad, e_MAX_FACE_TYPE }
 
enum  MaterialType { e_unset_material = -1 }
 

Public Member Functions

 Element (Type type)
 
 ~Element ()
 
int getID () const
 
void setID (int theID)
 
virtual int getNumNodes () const =0
 
Node ** getNodes ()
 
virtual int getNumFaces () const =0
 
Face ** getFaces ()
 
Type getElementType () const
 
boolean isCohesive () const
 
int getMaterialType () const
 
void setMaterialType (int mtype)
 
virtual void setFromNodes (Node **thenodes)
 
void replaceNode (Node *node, Node *new_node)
 
void replaceFace (Face *face, Face *new_face)
 
virtual void replaceFaceNode (Node *node, Node *new_node, Face *face)
 
virtual double getMinEdgeLength ()
 

Static Public Member Functions

static Elementcreate (int id, Type type)
 
static void setMesh (Mesh *emesh)
 

Protected Member Functions

virtual void setFromMyNodes ()=0
 
virtual void setFaceFromNodes (int num, Node **nodes)=0
 
void setFace (int num, Face *face)
 

Protected Attributes

Type d_eType
 
int d_ID
 
Node ** d_nodes
 
Face ** d_faces
 
int d_materialType
 

Static Protected Attributes

static Meshs_mesh = 0
 

Friends

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

Detailed Description

Definition at line 12 of file Element.hpp.

Member Enumeration Documentation

enum fType
Enumerator
e_tri 
e_quad 
e_MAX_FACE_TYPE 

Definition at line 23 of file Element.hpp.

Enumerator
e_unset_material 

Definition at line 29 of file Element.hpp.

29  {
30  e_unset_material = -1
31  };
enum Type
Enumerator
e_tet 
e_hex 
e_tri_cohesive 
e_quad_cohesive 
e_MAX_TYPE 

Definition at line 15 of file Element.hpp.

Constructor & Destructor Documentation

Element ( Type  type)

Definition at line 17 of file Element.cpp.

17  :
18 d_eType( type ),
19 d_ID(-1),
20 d_nodes(0),
21 d_faces(0),
23 {}
Face ** d_faces
Definition: Element.hpp:87
int d_ID
Definition: Element.hpp:84
Type d_eType
Definition: Element.hpp:82
Node ** d_nodes
Definition: Element.hpp:86
int d_materialType
Definition: Element.hpp:89
~Element ( )

Definition at line 25 of file Element.cpp.

References d_faces, and d_nodes.

25  {
26 
27  if( d_nodes ){
28  delete [] d_nodes;
29  }
30  if( d_faces ){
31  delete [] d_faces;
32  }
33 }
Face ** d_faces
Definition: Element.hpp:87
Node ** d_nodes
Definition: Element.hpp:86

Member Function Documentation

Element * create ( int  id,
Element::Type  type 
)
static

Definition at line 35 of file Element.cpp.

References e_hex, e_quad_cohesive, e_tet, e_tri_cohesive, and setID().

Referenced by operator>>().

35  {
36 
37  Element *elem;
38 
39  switch( type ){
40  case e_hex:
41  elem = new HexElement();
42  break;
43  case e_tet:
44  elem = new TetElement();
45  break;
46  case e_tri_cohesive:
47  elem = new TCoElement();
48  break;
49  case e_quad_cohesive:
50  elem = new QCoElement();
51  break;
52  default:
53  cerr << "BUG: Illegal element type in construction " << type << endl;
54  }
55  elem->setID( id );
56  return elem;
57 }
void setID(int theID)
Definition: Element.hpp:100

Here is the call graph for this function:

Here is the caller graph for this function:

Element::Type getElementType ( ) const
inline

Definition at line 109 of file Element.hpp.

References d_eType.

110 { return d_eType; }
Type d_eType
Definition: Element.hpp:82
Face ** getFaces ( )
inline

Definition at line 106 of file Element.hpp.

References d_faces.

Referenced by TriFace::buildCohesive(), QuadFace::buildCohesive(), Mesh::replaceNode(), and Mesh::write_boundary().

107 { return d_faces; }
Face ** d_faces
Definition: Element.hpp:87

Here is the caller graph for this function:

int getID ( ) const
inline

Definition at line 97 of file Element.hpp.

References d_ID.

Referenced by Mesh::write_boundary().

98 { return d_ID; }
int d_ID
Definition: Element.hpp:84

Here is the caller graph for this function:

int getMaterialType ( ) const
inline

Definition at line 118 of file Element.hpp.

References d_materialType.

Referenced by Mesh::addCohesive().

119 { return d_materialType; }
int d_materialType
Definition: Element.hpp:89

Here is the caller graph for this function:

double getMinEdgeLength ( )
virtual

Reimplemented in TetElement.

Definition at line 173 of file Element.cpp.

173  {
174  assert( 0 );
175 }
Node ** getNodes ( )
inline

Definition at line 103 of file Element.hpp.

References d_nodes.

104 { return d_nodes; }
Node ** d_nodes
Definition: Element.hpp:86
virtual int getNumFaces ( ) const
pure virtual

Implemented in TetElement, HexElement, QCoElement, and TCoElement.

Referenced by replaceFace(), replaceNode(), Mesh::replaceNode(), and Mesh::write_boundary().

Here is the caller graph for this function:

virtual int getNumNodes ( ) const
pure virtual

Implemented in TetElement, HexElement, QCoElement, and TCoElement.

Referenced by operator<<(), operator>>(), replaceNode(), and setFromNodes().

Here is the caller graph for this function:

boolean isCohesive ( ) const
inline

Definition at line 112 of file Element.hpp.

References d_eType, e_quad_cohesive, e_tri_cohesive, FALSE, and TRUE.

Referenced by Mesh::addCohesive(), Node::getSeparateElements(), and Mesh::replaceNode().

112  {
113  return ( d_eType == e_tri_cohesive || d_eType == e_quad_cohesive
114  ? TRUE
115  : FALSE );
116 }
#define FALSE
Definition: vinci.h:133
Type d_eType
Definition: Element.hpp:82
#define TRUE
Definition: vinci.h:134

Here is the caller graph for this function:

void replaceFace ( Face face,
Face new_face 
)

Definition at line 155 of file Element.cpp.

References d_faces, getNumFaces(), and i.

Referenced by TriFace::buildCohesive().

155  {
156 
157  int i;
158  int numf = getNumFaces();
159  for( i = 0; i< numf; i++ ){
160  if( d_faces[i] == face ){
161  d_faces[i] = new_face;
162  }
163  }
164 }
Face ** d_faces
Definition: Element.hpp:87
virtual int getNumFaces() const =0
blockLoc i
Definition: read.cpp:79

Here is the call graph for this function:

Here is the caller graph for this function:

void replaceFaceNode ( Node node,
Node new_node,
Face face 
)
virtual

Reimplemented in QCoElement, and TCoElement.

Definition at line 168 of file Element.cpp.

Referenced by Mesh::replaceNode().

168  {
169  assert( 0 );
170 }

Here is the caller graph for this function:

void replaceNode ( Node node,
Node new_node 
)

Definition at line 138 of file Element.cpp.

References Node::addElement(), d_faces, d_nodes, getNumFaces(), getNumNodes(), i, Node::removeElement(), and Face::replaceNode().

Referenced by Mesh::replaceNode().

138  {
139 
140  int i;
141  int numn = getNumNodes();
142  for( i = 0; i< numn; i++ ){
143  if( d_nodes[i] == node ){
144  d_nodes[i] = new_node;
145  node->removeElement( this );
146  new_node->addElement( this );
147  }
148  }
149  int numf = getNumFaces();
150  for( i = 0; i < numf; i++ ){
151  d_faces[i]->replaceNode( node, new_node );
152  }
153 }
Face ** d_faces
Definition: Element.hpp:87
virtual int getNumNodes() const =0
void replaceNode(Node *node, Node *new_node)
Definition: Face.cpp:93
Node ** d_nodes
Definition: Element.hpp:86
virtual int getNumFaces() const =0
blockLoc i
Definition: read.cpp:79
void addElement(Element *elem)
Definition: Node.cpp:86
void removeElement(Element *elem)
Definition: Node.cpp:102

Here is the call graph for this function:

Here is the caller graph for this function:

void setFace ( int  num,
Face face 
)
inlineprotected

Definition at line 127 of file Element.hpp.

References Face::addElement(), d_faces, and face.

Referenced by HexElement::setFaceFromNodes(), TetElement::setFaceFromNodes(), TCoElement::setFaceFromNodes(), and QCoElement::setFaceFromNodes().

127  {
128  d_faces[num] = face;
129  face->addElement( this );
130 }
Face ** d_faces
Definition: Element.hpp:87
void addElement(Element *theElement)
Definition: Face.hpp:200
static T_VertexSet * face
Definition: vinci_lass.c:79

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void setFaceFromNodes ( int  num,
Node **  nodes 
)
protectedpure virtual

Implemented in QCoElement, TCoElement, TetElement, and HexElement.

virtual void setFromMyNodes ( )
protectedpure virtual

Implemented in QCoElement, TCoElement, TetElement, and HexElement.

Referenced by operator>>(), and setFromNodes().

Here is the caller graph for this function:

void setFromNodes ( Node **  thenodes)
virtual

Definition at line 59 of file Element.cpp.

References Node::addElement(), d_nodes, getNumNodes(), i, and setFromMyNodes().

Referenced by HexElement::HexElement(), QCoElement::QCoElement(), TCoElement::TCoElement(), and TetElement::TetElement().

59  {
60 
61  int numn = getNumNodes();
62  int i;
63  for( i = 0; i < numn; i++ ){
64  d_nodes[i] = thenodes[i];
65  d_nodes[i]->addElement( this );
66  }
68 }
virtual int getNumNodes() const =0
Node ** d_nodes
Definition: Element.hpp:86
virtual void setFromMyNodes()=0
blockLoc i
Definition: read.cpp:79
void addElement(Element *elem)
Definition: Node.cpp:86

Here is the call graph for this function:

Here is the caller graph for this function:

void setID ( int  theID)
inline

Definition at line 100 of file Element.hpp.

References d_ID.

Referenced by Mesh::addElement(), create(), and Mesh::removeElement().

101 { d_ID = theID; }
int d_ID
Definition: Element.hpp:84

Here is the caller graph for this function:

void setMaterialType ( int  mtype)
inline

Definition at line 121 of file Element.hpp.

References d_materialType.

Referenced by Mesh::replaceNode().

122 { d_materialType = mtype; }
int d_materialType
Definition: Element.hpp:89

Here is the caller graph for this function:

void setMesh ( Mesh emesh)
inlinestatic

Definition at line 124 of file Element.hpp.

References s_mesh.

Referenced by Mesh::Mesh().

125 { s_mesh = emesh; }
static Mesh * s_mesh
Definition: Element.hpp:91

Here is the caller graph for this function:

Friends And Related Function Documentation

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

Definition at line 91 of file Element.cpp.

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
istream& operator>> ( istream &  stream,
Element elem 
)
friend

Definition at line 70 of file Element.cpp.

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

Member Data Documentation

Type d_eType
protected

Definition at line 82 of file Element.hpp.

Referenced by getElementType(), isCohesive(), and operator<<().

int d_ID
protected

Definition at line 84 of file Element.hpp.

Referenced by getID(), operator<<(), and setID().

int d_materialType
protected

Definition at line 89 of file Element.hpp.

Referenced by getMaterialType(), operator<<(), operator>>(), and setMaterialType().


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