19 #include <gsIO/gsBase64.h>
31 const unsigned d = basis.dim();
43 std::vector<Vertex> map(1ULL<<d);
47 std::vector<std::vector<unsigned> > neighbour(1ULL<<d,
48 std::vector<unsigned>() );
55 for (
unsigned dim = 0; dim < d; dim++)
59 const unsigned tmp = counter | (1<< dim) ;
60 neighbour[counter].push_back(tmp);
69 for (; domIter->good(); domIter->next())
73 const T vol = domIter->volume();
83 for (
unsigned dim = 0; dim < d; dim++)
85 vertex(dim) = ( cur(dim) ? upp(dim) : low(dim) );
88 Vertex v = mesh.addVertex(vertex);
96 for (
size_t index = 0; index != neighbour.size(); index++)
98 const std::vector<unsigned> & v = neighbour[index];
100 for (
size_t ngh = 0; ngh != v.size(); ngh++)
103 mesh.
addLine( map[index], map[v[ngh]], n );
122 template <
short_t d,
typename T>
129 for (
unsigned i = 0; i < basis.
maxLevel() + 1; i++)
141 std::vector<std::vector<unsigned> > neighbour(1 << d,
142 std::vector<unsigned>() );
150 for (
unsigned dim = 0; dim < d; dim++)
154 const unsigned tmp = counter | (1<< dim) ;
155 neighbour[counter].push_back(tmp);
166 std::vector<Vertex> map(1 << d);
172 for (; domIter.
good(); domIter.
next())
175 int level = domIter.getLevel();
189 for (
unsigned dim = 0; dim < d; dim++)
191 vertex(dim) = ( cur(dim) ? upp(dim) : low(dim) );
194 meshes[level].addVertex(vertex);
195 map[counter++] = meshes[level].vertices().back();
201 for (
size_t index = 0; index != neighbour.size(); index++)
203 const std::vector<unsigned> & v = neighbour[index];
205 for (
size_t ngh = 0; ngh != v.size(); ngh++)
208 meshes[level].addLine( map[index], map[v[ngh]], n );
226 template <
typename T>
237 internal::makeHierarchicalMesh<1, T>(*hBasis1, meshes, n);
247 internal::makeHierarchicalMesh<2, T>(*hBasis2, meshes, n);
257 internal::makeHierarchicalMesh<3, T>(*hBasis3, meshes, n);
Re-implements gsDomainIterator for iteration over all boundary elements of a hierarchical parameter d...
Definition: gsHDomain.h:24
Provides definition of HTensorBasis abstract interface.
Provides declaration of iterator of hierarchical domain.
bool nextCubePoint(Vec &cur, const Vec &end)
Iterate in lexigographic order through the points of the integer lattice contained in the cube [0...
Definition: gsCombinatorics.h:327
void makeMesh(const gsBasis< T > &basis, gsMesh< T > &mesh, int n=0)
Returns the computational mesh of basis.
Definition: gsIOUtils.h:29
bool good() const
Is the iterator still pointing to a valid element?
Definition: gsDomainIterator.h:112
This file contains the debugging and messaging system of G+Smo.
bool makeHierarchicalMesh(const gsBasis< T > &basis, std::vector< gsMesh< T > > &meshes, int n=0)
Definition: gsIOUtils.h:227
Class Representing a triangle mesh with 3D vertices.
Definition: gsMesh.h:31
Class representing a (scalar) hierarchical tensor basis of functions .
Definition: gsHTensorBasis.h:74
void addLine(gsMatrix< T > const &points)
Definition: gsMesh.hpp:329
const gsVector< T > & upperCorner() const
Returns the upper corner of the current element.
Definition: gsHDomainIterator.h:122
unsigned maxLevel() const
Returns the level in which the indices are stored internally.
Definition: gsHTensorBasis.h:811
void makeHierarchicalMesh(const gsHTensorBasis< d, T > &basis, std::vector< gsMesh< T > > &meshes, int n=0)
Look at function gismo::makeHierarchicalMesh.
Definition: gsIOUtils.h:123
virtual domainIter makeDomainIterator() const
Create a domain iterator for the computational mesh of this basis, that points to the first element o...
Definition: gsBasis.hpp:493
A basis represents a family of scalar basis functions defined over a common parameter domain...
Definition: gsBasis.h:78
bool next()
Proceeds to the next element.
Definition: gsHDomainIterator.h:75
const gsVector< T > & lowerCorner() const
Returns the lower corner of the current element.
Definition: gsHDomainIterator.h:120
gsVertex class that represents a 3D vertex for a gsMesh.
Definition: gsVertex.h:26