Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TriFace.cpp
Go to the documentation of this file.
1 /* Generated by Together */
2 
3 #include "TriFace.hpp"
4 #include "TCoElement.hpp"
5 
6 TriFace::TriFace(Node * * theNodes):
7  Face( e_tri )
8 {
9  d_nodes = new Node*[3];
10  int i;
11  for( i = 0; i < 3; i++ ){
12  d_nodes[i] = theNodes[i];
13  d_nodes[i]->addFace( this );
14  }
15 }
16 
18  d_nodes = new Node*[3];
19  int i;
20  for (i=0; i<3; i++) d_nodes[i]=0;
21 }
22 
24  int i;
25  for( i = 0; i < 3; i++ ){
26  d_nodes[i]->removeFace( this );
27  }
28 }
29 
31 { return 3; }
32 
33 
35  Node* new_node ){
36 
37  int ind=-1;
38  int i;
39  for( i = 0; i < 3; i++ ){
40  if( d_nodes[i] == node ){
41  ind = i;
42  break;
43  }
44  }
45  Element* coelem;
46 
47  Node* new_nodes[6];
48 
49  //the order of the second three nodes looks wrong - need to assess and
50  //correct if so. Order should be 1,2,3, and 4,5,6 with 4 corresponding to
51  //3 and not to 1.
52 
53  //Note: when a cohesive element is made, it always has two doubled node
54  //numbers: when do they get updated?
55 
56  if( d_E1 == side_elem ){ // normal to side
57  new_nodes[0] = d_nodes[0];
58  new_nodes[1] = d_nodes[1];
59  new_nodes[2] = d_nodes[2];
60  new_nodes[3] = (ind == 0 ? new_node : d_nodes[0] );
61  new_nodes[4] = (ind == 1 ? new_node : d_nodes[1] );
62  new_nodes[5] = (ind == 2 ? new_node : d_nodes[2] );
63  d_E1 = d_E2;
64  d_E2 = 0;
65  coelem = new TCoElement( new_nodes );
66  // now for this face set E1 to the coelem
67  d_E2 = d_E1;
68  d_E1 = coelem;
69  Face* oface = coelem->getFaces()[1];
70  ((TriFace*)oface)->d_E2 = side_elem;
71  side_elem->replaceFace( this, oface );
72  }
73  else { // normal to the other side
74  d_E2 = 0;
75  new_nodes[0] = (ind == 0 ? new_node : d_nodes[0] );
76  new_nodes[1] = (ind == 1 ? new_node : d_nodes[1] );
77  new_nodes[2] = (ind == 2 ? new_node : d_nodes[2] );
78  new_nodes[3] = d_nodes[0];
79  new_nodes[4] = d_nodes[1];
80  new_nodes[5] = d_nodes[2];
81  coelem = new TCoElement( new_nodes );
82  // now for the new face set E2 to side_elem (will correct the nodes later)
83  Face* oface = coelem->getFaces()[0];
84  ((TriFace*)oface)->d_E2 = side_elem;
85  side_elem->replaceFace( this, oface );
86  }
87  return coelem;
88 }
89 
This class encapsulate a node over a window manifold.
Definition: Manifold_2.h:370
virtual int getNumNodes() const
Returns the number of nodes for this type of face (three for the triangular face).
Definition: TriFace.cpp:30
void addFace(Face *face)
Definition: Node.cpp:55
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
Definition: adj.h:150
virtual Element * buildCohesive(Element *side_elem, Node *node, Node *new_node)
Definition: TriFace.cpp:34
Face ** getFaces()
Definition: Element.hpp:106
~TriFace()
Destructor.
Definition: TriFace.cpp:23
blockLoc i
Definition: read.cpp:79
Node ** d_nodes
Array of nodes assigned to this face.
Definition: Face.hpp:161
TriFace()
Definition: TriFace.cpp:17
void replaceFace(Face *face, Face *new_face)
Definition: Element.cpp:155
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