16 class BSExtent :
public std::vector<std::vector<T> >
20 std::vector<size_t>
_Np;
21 std::vector<size_t>
_N;
30 BSExtent(
const std::vector<std::vector<T> > &inextent)
32 _nd = inextent.size();
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++);
42 _nd = inflatextent.size()/2;
46 while(bsi != this->end()){
47 bsi->push_back(inflatextent[nd++]);
48 bsi->push_back(inflatextent[nd++]);
56 unsigned int nindex = 0;
58 while(bsi != this->end()){
59 bsi->push_back(src[nindex++]);
60 bsi->push_back(src[nindex++]);
68 while(bsi != this->end())
75 void Init(
const std::vector<T> &inflatextent){
77 _nd = inflatextent.size()/2;
81 while(bsi != this->end()){
82 bsi->push_back(inflatextent[nd++]);
83 bsi->push_back(inflatextent[nd++]);
93 for(
size_t i = 0;
i <
_nd;
i++){
94 _N[
i] = (*this)[
i][1] - (*this)[
i][0] + 1;
97 for(
size_t i = 1;
i <
_nd;
i++){
104 while(bsi != this->end()){
105 nnodes *= (((*bsi)[1] - (*bsi)[0])+1);
110 int ND(){
return(this->size());};
115 while(bsi != this->end()){
116 output.push_back((*bsi)[0]);
117 output.push_back((*bsi)[1]);
121 void dir_loop(
int nd,T indoff,T plane,std::vector<T> &N,
123 std::vector<T> &indices)
127 T start = inextent[dindex][0];
128 T end = inextent[dindex][1];
129 for(T dd = start;dd <= end;dd++){
131 indices.push_back(dd - (*
this)[dindex][0]+1+indoff);
133 T ndoff = indoff + (dd - (*this)[dindex][0])*NP[dindex];
134 dir_loop(dindex,ndoff,plane,N,NP,inextent,indices);
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]);
150 dir_loop(nd,0,0,N,NP,extent,indices);
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])))
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]);
175 std::vector<T> &neighbors)
177 shared_extents.resize(0);
179 typename std::vector<BSExtent<T> >::iterator epi = extent_pool.begin();
180 while(epi != extent_pool.end()){
184 if(!overlap.empty()){
185 neighbors.push_back(nindex);
186 shared_extents.push_back(overlap);
196 for(
size_t i = (
_nd-1);
i >= 0;
i--)
197 l0 += (index[
i] - (*
this)[
i][0])*
_Np[
i];
208 for(
int i = 0;
i < 3;
i++){
215 std::vector<T> indices;
218 IndexType planeoffset = (mesh_nd == 2 ? 0 : offset*
_N[1]);
219 IndexType number_of_elements = indices.size();
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);
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);
240 std::vector<Mesh::IndexType> &gridsizes,
BSExtent(const std::vector< std::vector< T > > &inextent)
void AddElement(const std::vector< IndexType > &elem)
General connectivity object.
int GenerateCartesianGrid(Mesh::NodalCoordinates &nc, Mesh::BSExtent< Mesh::IndexType > &gridextent, std::vector< Mesh::IndexType > &gridsizes, GeoPrim::CBox &box)
void CreateUnstructuredMesh(Connectivity &conn)
void FindSharedNodes(std::vector< BSExtent< T > > &extent_pool, std::vector< BSExtent< T > > &shared_extents, std::vector< T > &neighbors)
void Overlap(const BSExtent< T > &inextent, BSExtent< T > &outextent)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Class Mesh is the main class that holds all information to describe the current state of the mesh...
real *8 function offset(vNorm, x2, y2, z2)
T NodeNum(std::vector< T > &index)
BSExtent(const T *src, int nd=3)
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 Flatten(std::vector< T > &output)
void GetFlatIndices(const BSExtent< T > &extent, std::vector< T > &indices)
std::vector< size_t > _Np
BSExtent(const std::vector< T > &inflatextent)
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
void Init(const std::vector< T > &inflatextent)
IRAD::Primitive::IndexType IndexType
Simple Block Structured Mesh object.