Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Face.cpp
Go to the documentation of this file.
1 /* Generated by Together */
2 
3 #include "Face.hpp"
4 #include "TriFace.hpp"
5 #include "QuadFace.hpp"
6 #include "Mesh.hpp"
7 
8 Mesh* Face::s_mesh = 0;
9 
11  d_ID(-1),
12  d_flag(-1),
13  d_E1(0),
14  d_E2(0),
15  d_nodes(0),
16  d_eType( ftype )
17 {}
18 
20  d_ID(-1),
21  d_flag(-1),
22  d_E1(0),
23  d_E2(0),
24  d_nodes(0)
25 {}
26 
28 
29  if( d_nodes ){
30  delete [] d_nodes;
31  }
32 }
33 
35 
36  Face *face;
37 
38  switch( type ){
39  case e_hex:
40  face = new QuadFace();
41  break;
42  case e_tet:
43  face = new TriFace();
44  break;
45  case e_tri_cohesive:
46  face = new TriFace();
47  break;
48  case e_quad_cohesive:
49  face = new QuadFace();
50  break;
51  default:
52  cerr << "BUG: Illegal element type in Face::create " << type << endl;
53  }
54 
55  return face;
56 }
57 
58 
59 ostream& operator<<(ostream& stream, Face& face){
60 
61  return stream;
62 }
63 
64 istream& operator>>(istream& stream, Face& face){
65 
66  // read nodes & set
67 
68  int numn = face.getNumNodes();
69  int i;
70  for( i = 0; i < numn; i++ ){
71  int node_id;
72  stream >> node_id;
73  Node *node = face.s_mesh->getNode(node_id);
74  face.d_nodes[i] = node;
75  }
76 
77  return stream;
78 
79 }
80 
81 void Face::removeElement(Element * theElement){
82 
83  if( theElement == d_E1 ){
84  d_E1 = d_E2;
85  d_E2 = 0;
86  }
87  else if( theElement == d_E2 ){
88  d_E2 = 0;
89  }
90 }
91 
92 
93 void Face::replaceNode (Node *node, Node *new_node ) {
94 
95  int i;
96  int numn = getNumNodes();
97  for( i = 0; i< numn; i++ ){
98  if( d_nodes[i] == node ){
99  d_nodes[i] = new_node;
100  node->removeFace( this );
101  new_node->addFace( this );
102  }
103  }
104 }
105 
106 
107 
108 boolean Face::containsNode( Node* node ) const {
109 
110  int i;
111  int numn = getNumNodes();
112  for( i = 0; i< numn; i++ ){
113  if( d_nodes[i] == node ){
114  return TRUE;
115  }
116  }
117  return FALSE;
118 }
119 
#define FALSE
Definition: vinci.h:133
static Mesh * s_mesh
Definition: Face.hpp:168
void replaceNode(Node *node, Node *new_node)
Definition: Face.cpp:93
This class encapsulate a node over a window manifold.
Definition: Manifold_2.h:370
Definition: face.h:90
void addFace(Face *face)
Definition: Node.cpp:55
static Face * create(eType type)
Definition: Face.cpp:34
Element * d_E2
The second element that this face is associated with.
Definition: Face.hpp:154
Element * d_E1
Pointer to the first element that this face is associated with.
Definition: Face.hpp:147
Class Mesh is the main class that holds all information to describe the current state of the mesh...
Definition: Mesh.hpp:19
Definition: adj.h:150
boolean containsNode(Node *node) const
Definition: Face.cpp:108
~Face()
Destructor.
Definition: Face.cpp:27
blockLoc i
Definition: read.cpp:79
void removeElement(Element *theElement)
Definition: Face.cpp:81
#define TRUE
Definition: vinci.h:134
Type
Definition: Face.hpp:22
Node * getNode(int ID)
The following get methods return a node, face or element.
Definition: Mesh.hpp:137
Face()
Definition: Face.cpp:19
static T_VertexSet * face
Definition: vinci_lass.c:79
Node ** d_nodes
Array of nodes assigned to this face.
Definition: Face.hpp:161
std::istream & operator>>(std::istream &is, CGAL::Aff_transformation_2< R > &t)
std::ostream & operator<<(std::ostream &os, const COM_exception &ex)
Print out a given exception.
void removeFace(Face *face)
Definition: Node.cpp:70
The Face class is an abstract base class that supplies implemented general methods, as well as a vew virtual interface methods to child classes.
Definition: Face.hpp:19
eType
Definition: Face.hpp:24
virtual int getNumNodes() const =0
Retrieves the number of nodes that make up the face.