Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Mesh::BSExtent< T > Class Template Reference

Simple Block Structured Mesh object. More...

#include <BSMesh.H>

Inheritance diagram for Mesh::BSExtent< T >:
Collaboration diagram for Mesh::BSExtent< T >:

Public Member Functions

 BSExtent ()
 
 BSExtent (const std::vector< std::vector< T > > &inextent)
 
 BSExtent (const std::vector< T > &inflatextent)
 
 BSExtent (const T *src, int nd=3)
 
void destroy ()
 
void Init (const std::vector< T > &inflatextent)
 
void Sync ()
 
NNodes ()
 
int ND ()
 
void Flatten (std::vector< T > &output)
 
void dir_loop (int nd, T indoff, T plane, std::vector< T > &N, std::vector< T > &NP, const BSExtent< T > &inextent, std::vector< T > &indices)
 
void GetFlatIndices (const BSExtent< T > &extent, std::vector< T > &indices)
 
void Overlap (const BSExtent< T > &inextent, BSExtent< T > &outextent)
 
void FindSharedNodes (std::vector< BSExtent< T > > &extent_pool, std::vector< BSExtent< T > > &shared_extents, std::vector< T > &neighbors)
 
NodeNum (std::vector< T > &index)
 
void CreateUnstructuredMesh (Connectivity &conn)
 

Private Attributes

size_t _nd
 
std::vector< size_t > _Np
 
std::vector< size_t > _N
 

Additional Inherited Members

- Public Attributes inherited from vector< T >
elements
 STL member. More...
 

Detailed Description

template<typename T>
class Mesh::BSExtent< T >

Simple Block Structured Mesh object.

Block structured mesh object holds irange, jrange, and krange. Elements are ordered in dictionary ordering of lower left node

Definition at line 16 of file BSMesh.H.

Constructor & Destructor Documentation

BSExtent ( )
inline

Definition at line 23 of file BSMesh.H.

References Mesh::BSExtent< T >::_N, Mesh::BSExtent< T >::_nd, and Mesh::BSExtent< T >::_Np.

24  {
25  this->resize(0);
26  _nd = 0;
27  _Np.resize(0);
28  _N.resize(0);
29  }
std::vector< size_t > _N
Definition: BSMesh.H:21
std::vector< size_t > _Np
Definition: BSMesh.H:20
size_t _nd
Definition: BSMesh.H:19
BSExtent ( const std::vector< std::vector< T > > &  inextent)
inline

Definition at line 30 of file BSMesh.H.

References Mesh::BSExtent< T >::_nd, i, and Mesh::BSExtent< T >::Sync().

31  {
32  _nd = inextent.size();
33  this->resize(_nd);
34  for(size_t i = 0; i < _nd; i++){
35  typename std::vector<T>::const_iterator iei = inextent[i].begin();
36  while(iei != inextent[i].end())
37  (*this)[i].push_back(*iei++);
38  }
39  Sync();
40  };
void Sync()
Definition: BSMesh.H:88
blockLoc i
Definition: read.cpp:79
size_t _nd
Definition: BSMesh.H:19

Here is the call graph for this function:

BSExtent ( const std::vector< T > &  inflatextent)
inline

Definition at line 41 of file BSMesh.H.

References Mesh::BSExtent< T >::_nd, and Mesh::BSExtent< T >::Sync().

41  {
42  _nd = inflatextent.size()/2;
43  this->resize(_nd);
44  size_t nd = 0;
45  typename BSExtent<T>::iterator bsi = this->begin();
46  while(bsi != this->end()){
47  bsi->push_back(inflatextent[nd++]);
48  bsi->push_back(inflatextent[nd++]);
49  bsi++;
50  }
51  Sync();
52  };
void Sync()
Definition: BSMesh.H:88
size_t _nd
Definition: BSMesh.H:19

Here is the call graph for this function:

BSExtent ( const T *  src,
int  nd = 3 
)
inline

Definition at line 53 of file BSMesh.H.

References Mesh::BSExtent< T >::_nd, and Mesh::BSExtent< T >::Sync().

53  {
54  _nd = nd;
55  this->resize(_nd);
56  unsigned int nindex = 0;
57  typename BSExtent<T>::iterator bsi = this->begin();
58  while(bsi != this->end()){
59  bsi->push_back(src[nindex++]);
60  bsi->push_back(src[nindex++]);
61  bsi++;
62  }
63  Sync();
64  };
void Sync()
Definition: BSMesh.H:88
size_t _nd
Definition: BSMesh.H:19

Here is the call graph for this function:

Member Function Documentation

void CreateUnstructuredMesh ( Connectivity conn)
inline

Definition at line 199 of file BSMesh.H.

References Mesh::BSExtent< T >::_N, Mesh::BSExtent< T >::_nd, Mesh::Connectivity::AddElement(), Mesh::BSExtent< T >::GetFlatIndices(), i, offset(), and Mesh::Connectivity::Sync().

Referenced by Rocon::burnout(), TRAIL_FD2FE_WinCreate(), TRAIL_FD2FE_WinCreate2(), and TRAIL_Window2UnstructuredMesh().

200  {
201  // get coordinates of lower left hand coordinates:
202  // istart to (iend - 1), or istart
203  // jstart to (jend - 1), or jstart
204  // kstart to (kend - 1), or kstart
205  assert(_nd == 3);
206  BSExtent<T> lowerleft(*this);
207  int mesh_nd = 3;
208  for(int i = 0;i < 3;i++){
209  if(_N[i] > 1)
210  lowerleft[i][1]--;
211  else
212  mesh_nd--;
213  }
214  assert(mesh_nd > 1);
215  std::vector<T> indices;
216  GetFlatIndices(lowerleft,indices);
217  IndexType offset = (_N[0] > 1 ? _N[0] : _N[1]);
218  IndexType planeoffset = (mesh_nd == 2 ? 0 : offset*_N[1]);
219  IndexType number_of_elements = indices.size();
220  for(IndexType i = 0;i < number_of_elements;i++){
221  std::vector<IndexType> element;
222  element.push_back(indices[i]);
223  element.push_back(indices[i]+1);
224  element.push_back(indices[i]+1+offset);
225  element.push_back(indices[i]+offset);
226  if(planeoffset > 0){
227  element.push_back(indices[i]+planeoffset);
228  element.push_back(indices[i]+1+planeoffset);
229  element.push_back(indices[i]+planeoffset+offset+1);
230  element.push_back(indices[i]+planeoffset+offset);
231  }
232  conn.AddElement(element);
233  }
234  conn.Sync();
235  };
real *8 function offset(vNorm, x2, y2, z2)
Definition: PlaneNorm.f90:211
void GetFlatIndices(const BSExtent< T > &extent, std::vector< T > &indices)
Definition: BSMesh.H:139
blockLoc i
Definition: read.cpp:79
std::vector< size_t > _N
Definition: BSMesh.H:21
size_t _nd
Definition: BSMesh.H:19
IRAD::Primitive::IndexType IndexType
Definition: Mesh.H:57

Here is the call graph for this function:

Here is the caller graph for this function:

void destroy ( )
inline

Definition at line 65 of file BSMesh.H.

References Mesh::BSExtent< T >::_N, Mesh::BSExtent< T >::_nd, and Mesh::BSExtent< T >::_Np.

Referenced by Mesh::BSExtent< T >::Init().

66  {
67  typename BSExtent<T>::iterator bsi = this->begin();
68  while(bsi != this->end())
69  bsi++->resize(0);
70  this->resize(0);
71  _nd = 0;
72  _Np.resize(0);
73  _N.resize(0);
74  };
std::vector< size_t > _N
Definition: BSMesh.H:21
std::vector< size_t > _Np
Definition: BSMesh.H:20
size_t _nd
Definition: BSMesh.H:19

Here is the caller graph for this function:

void dir_loop ( int  nd,
indoff,
plane,
std::vector< T > &  N,
std::vector< T > &  NP,
const BSExtent< T > &  inextent,
std::vector< T > &  indices 
)
inline

Definition at line 121 of file BSMesh.H.

Referenced by Mesh::BSExtent< T >::GetFlatIndices().

124  {
125  int dindex = nd - 1;
126  plane += NP[dindex];
127  T start = inextent[dindex][0];
128  T end = inextent[dindex][1];
129  for(T dd = start;dd <= end;dd++){
130  if(dindex == 0)
131  indices.push_back(dd - (*this)[dindex][0]+1+indoff);
132  else{
133  T ndoff = indoff + (dd - (*this)[dindex][0])*NP[dindex];
134  dir_loop(dindex,ndoff,plane,N,NP,inextent,indices);
135  }
136  }
137 
138  };
void dir_loop(int nd, T indoff, T plane, std::vector< T > &N, std::vector< T > &NP, const BSExtent< T > &inextent, std::vector< T > &indices)
Definition: BSMesh.H:121

Here is the caller graph for this function:

void FindSharedNodes ( std::vector< BSExtent< T > > &  extent_pool,
std::vector< BSExtent< T > > &  shared_extents,
std::vector< T > &  neighbors 
)
inline

Definition at line 174 of file BSMesh.H.

References Mesh::BSExtent< T >::Overlap().

Referenced by TRAIL_FD2FE_WinCreate2().

176  {
177  shared_extents.resize(0);
178  T nindex = 0;
179  typename std::vector<BSExtent<T> >::iterator epi = extent_pool.begin();
180  while(epi != extent_pool.end()){
181  if(*epi != *this){
182  BSExtent<T> overlap;
183  this->Overlap(*epi,overlap);
184  if(!overlap.empty()){
185  neighbors.push_back(nindex);
186  shared_extents.push_back(overlap);
187  }
188  }
189  nindex++;
190  epi++;
191  }
192  };
void Overlap(const BSExtent< T > &inextent, BSExtent< T > &outextent)
Definition: BSMesh.H:152

Here is the call graph for this function:

Here is the caller graph for this function:

void Flatten ( std::vector< T > &  output)
inline

Definition at line 111 of file BSMesh.H.

Referenced by TRAIL_FD2FE_Transfer(), TRAIL_FD2FE_WinCreate(), and TRAIL_FD2FE_WinCreate2().

112  {
113  output.resize(0);
114  typename BSExtent<T>::iterator bsi = this->begin();
115  while(bsi != this->end()){
116  output.push_back((*bsi)[0]);
117  output.push_back((*bsi)[1]);
118  bsi++;
119  }
120  };

Here is the caller graph for this function:

void GetFlatIndices ( const BSExtent< T > &  extent,
std::vector< T > &  indices 
)
inline

Definition at line 139 of file BSMesh.H.

References Mesh::BSExtent< T >::dir_loop(), and Mesh::BSExtent< T >::ND().

Referenced by Mesh::BSExtent< T >::CreateUnstructuredMesh(), main(), test2(), TRAIL_FD2FE_Transfer(), TRAIL_FD2FE_WinCreate(), TRAIL_FD2FE_WinCreate2(), TRAIL_FE2FD_Transfer(), and TRAIL_Window2UnstructuredMesh().

140  {
141  int nd = ND();
142  indices.resize(0);
143  std::vector<T> N(nd);
144  std::vector<T> NP(nd);
145  for(int nc = 0;nc < nd;nc++){
146  N[nc] = (*this)[nc][1] - (*this)[nc][0] + 1;
147  NP[nc] = (nc == 0 ? 1 : N[nc-1] * NP[nc-1]);
148  }
149  NP[0] = 0;
150  dir_loop(nd,0,0,N,NP,extent,indices);
151  };
void dir_loop(int nd, T indoff, T plane, std::vector< T > &N, std::vector< T > &NP, const BSExtent< T > &inextent, std::vector< T > &indices)
Definition: BSMesh.H:121
int ND()
Definition: BSMesh.H:110

Here is the call graph for this function:

Here is the caller graph for this function:

void Init ( const std::vector< T > &  inflatextent)
inline

Definition at line 75 of file BSMesh.H.

References Mesh::BSExtent< T >::_nd, Mesh::BSExtent< T >::destroy(), and Mesh::BSExtent< T >::Sync().

Referenced by main(), and test2().

75  {
76  destroy();
77  _nd = inflatextent.size()/2;
78  this->resize(_nd);
79  size_t nd = 0;
80  typename BSExtent<T>::iterator bsi = this->begin();
81  while(bsi != this->end()){
82  bsi->push_back(inflatextent[nd++]);
83  bsi->push_back(inflatextent[nd++]);
84  bsi++;
85  }
86  Sync();
87  };
void Sync()
Definition: BSMesh.H:88
void destroy()
Definition: BSMesh.H:65
size_t _nd
Definition: BSMesh.H:19

Here is the call graph for this function:

Here is the caller graph for this function:

int ND ( )
inline

Definition at line 110 of file BSMesh.H.

Referenced by Mesh::BSExtent< T >::GetFlatIndices(), and Mesh::BSExtent< T >::Overlap().

110 {return(this->size());};

Here is the caller graph for this function:

T NNodes ( )
inline

Definition at line 101 of file BSMesh.H.

Referenced by TRAIL_FD2FE_Transfer(), TRAIL_FD2FE_WinCreate(), and TRAIL_FD2FE_WinCreate2().

101  {
102  T nnodes = 1;
103  typename BSExtent<T>::iterator bsi = this->begin();
104  while(bsi != this->end()){
105  nnodes *= (((*bsi)[1] - (*bsi)[0])+1);
106  bsi++;
107  }
108  return(nnodes);
109  };

Here is the caller graph for this function:

T NodeNum ( std::vector< T > &  index)
inline

Definition at line 193 of file BSMesh.H.

References Mesh::BSExtent< T >::_nd, Mesh::BSExtent< T >::_Np, and i.

194  {
195  T l0 = 1;
196  for(size_t i = (_nd-1);i >= 0;i--)
197  l0 += (index[i] - (*this)[i][0])*_Np[i];
198  };
blockLoc i
Definition: read.cpp:79
std::vector< size_t > _Np
Definition: BSMesh.H:20
size_t _nd
Definition: BSMesh.H:19
void Overlap ( const BSExtent< T > &  inextent,
BSExtent< T > &  outextent 
)
inline

Definition at line 152 of file BSMesh.H.

References i, j, max(), min(), and Mesh::BSExtent< T >::ND().

Referenced by Mesh::BSExtent< T >::FindSharedNodes(), and TRAIL_FD2FE_Transfer().

153  {
154  size_t nd = ND();
155  outextent.resize(0);
156  bool match = true;
157  for(size_t j = 0;j < nd && match;j++){
158  if(!(((*this)[j][0] >= inextent[j][0] &&
159  (*this)[j][0] <= inextent[j][1]) ||
160  ((*this)[j][1] >= inextent[j][0] &&
161  (*this)[j][1] <= inextent[j][1])))
162  match = false;
163  }
164  if(match){ // then this extent has some overlap with the searched
165  outextent.resize(nd);
166  for(size_t i = 0;i < nd;i++)
167  outextent[i].resize(2);
168  for(size_t i = 0;i < nd;i++){
169  outextent[i][0] = std::max((*this)[i][0],inextent[i][0]);
170  outextent[i][1] = std::min((*this)[i][1],inextent[i][1]);
171  }
172  }
173  };
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
blockLoc i
Definition: read.cpp:79
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
j indices j
Definition: Indexing.h:6
int ND()
Definition: BSMesh.H:110

Here is the call graph for this function:

Here is the caller graph for this function:

void Sync ( )
inline

Definition at line 88 of file BSMesh.H.

References Mesh::BSExtent< T >::_N, Mesh::BSExtent< T >::_nd, Mesh::BSExtent< T >::_Np, and i.

Referenced by Mesh::BSExtent< T >::BSExtent(), Mesh::BSExtent< T >::Init(), TRAIL_FD2FE_WinCreate(), and TRAIL_FD2FE_WinCreate2().

89  {
90  _nd = this->size();
91  _N.resize(_nd);
92  _Np.resize(_nd);
93  for(size_t i = 0; i < _nd; i++){
94  _N[i] = (*this)[i][1] - (*this)[i][0] + 1;
95  }
96  _Np[0] = 1;
97  for(size_t i = 1; i < _nd;i++){
98  _Np[i] = _N[i-1] * _Np[i-1];
99  }
100  };
blockLoc i
Definition: read.cpp:79
std::vector< size_t > _N
Definition: BSMesh.H:21
std::vector< size_t > _Np
Definition: BSMesh.H:20
size_t _nd
Definition: BSMesh.H:19

Here is the caller graph for this function:

Member Data Documentation

std::vector<size_t> _Np
private

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