The Original CHomP Software
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes | List of all members
chomp::homology::tCube2l< tCube > Class Template Reference

A (hyper)cube with additional information about the layer number. More...

#include <twolayer.h>

Public Types

typedef theLayerType LayerType
 The type for keeping the layer number. More...
 
typedef tCube CubeType
 The type for keeping the cube at the given layer. More...
 
typedef tCube::CoordType CoordType
 The type of the coordinates. More...
 
typedef tCell2l< typename tCube::CellType > CellType
 The type of a cell related to this cube type. More...
 
typedef tCube::PointBase PointBase
 The point base (for wrapping and tabulating coordinates). More...
 

Public Member Functions

 tCube2l ()
 The default constructor. More...
 
 tCube2l (const tCube &_q, const LayerType &_l)
 The constructor of a cube at a given layer. More...
 
 tCube2l (const CoordType *coord, int dim)
 The constructor from a table of coordinates. More...
 
 tCube2l (const CoordType *coord, int dim, const LayerType &_l)
 The constructor from a table of coordinates and a layer. More...
 
 tCube2l (int_t number, int dim)
 The constructor from a number (if valid for the base class). More...
 
 tCube2l (const tCube2l &c)
 The copy constructor. More...
 
tCube2loperator= (const tCube2l &c)
 The assignment operator. More...
 
int dim () const
 Returns the dimension of the cube. More...
 
template<class intType >
intType * coord (intType *c) const
 Fills out the coordinate table with the cube's coordinates. More...
 
int_t hashkey1 () const
 Returns the hash key no. 1 required by the hashing set template. More...
 
int_t hashkey2 () const
 Returns the hash key no. 2 required by the hashing set template. More...
 
const LayerTypelayer () const
 Returns the layer number. More...
 
const tCube & cube () const
 Returns the cube without the layer. More...
 
void layer (const typename tCube2l< tCube >::LayerType &newlayer)
 Sets the layer number. More...
 

Static Public Member Functions

static const char * name ()
 Returns the name of the objects represented by this class. More...
 
static const char * pluralname ()
 Returns the plural name of the objects represented by this class. More...
 
static void setlayers (const hashedset< tCube > &X, const hashedset< tCube > &A)
 Defines the set of cubes at layer 1 (X). More...
 
static const hashedset< tCube > & layer1 ()
 Returns the set of cubes at layer 1. More...
 
static const hashedset< tCube > & layer1b ()
 Returns the set of cubes at the boundary of layer 1. More...
 
static const hashedset< tCube > & layer0 ()
 Returns the set of cubes at layer 0 which are neighbors of cubes at layer 1 by the identification of layers. More...
 

Static Public Attributes

static const int MaxDim = tCube::MaxDim
 The maximal dimension of a cube. More...
 

Private Attributes

tCube q
 The actual cube at the given layer. More...
 
LayerType l
 The layer to which the cube belongs. More...
 

Static Private Attributes

static hashedset< tCube > layer1set
 The set of full-dimensional cubes at layer 1. More...
 
static hashedset< tCube > layer1boundary
 The set of full-dimensional cubes at layer 1 adjacent to cubes at layer 0. More...
 
static hashedset< tCube > layer0set
 The set of full-dimensional cubes at layer 0 which are adjacent to the cubes at layer 1. More...
 

Detailed Description

template<class tCube>
class chomp::homology::tCube2l< tCube >

A (hyper)cube with additional information about the layer number.

By default, the layer number is zero, unless set otherwise.

Definition at line 79 of file twolayer.h.

Member Typedef Documentation

◆ CellType

template<class tCube >
typedef tCell2l<typename tCube::CellType> chomp::homology::tCube2l< tCube >::CellType

The type of a cell related to this cube type.

Definition at line 92 of file twolayer.h.

◆ CoordType

template<class tCube >
typedef tCube::CoordType chomp::homology::tCube2l< tCube >::CoordType

The type of the coordinates.

Definition at line 89 of file twolayer.h.

◆ CubeType

template<class tCube >
typedef tCube chomp::homology::tCube2l< tCube >::CubeType

The type for keeping the cube at the given layer.

Definition at line 86 of file twolayer.h.

◆ LayerType

template<class tCube >
typedef theLayerType chomp::homology::tCube2l< tCube >::LayerType

The type for keeping the layer number.

Definition at line 83 of file twolayer.h.

◆ PointBase

template<class tCube >
typedef tCube::PointBase chomp::homology::tCube2l< tCube >::PointBase

The point base (for wrapping and tabulating coordinates).

Definition at line 98 of file twolayer.h.

Constructor & Destructor Documentation

◆ tCube2l() [1/6]

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l
inline

The default constructor.

Definition at line 203 of file twolayer.h.

203 : q (), l (0)
204{
205 return;
206} /* tCube2l */
LayerType l
The layer to which the cube belongs.
Definition: twolayer.h:172
tCube q
The actual cube at the given layer.
Definition: twolayer.h:169

◆ tCube2l() [2/6]

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l ( const tCube &  _q,
const LayerType _l 
)
inline

The constructor of a cube at a given layer.

Definition at line 209 of file twolayer.h.

210: q (_q), l (_l)
211{
212 return;
213} /* tCube2l */

◆ tCube2l() [3/6]

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l ( const CoordType coord,
int  dim 
)
inline

The constructor from a table of coordinates.

Definition at line 216 of file twolayer.h.

216 :
217 q (coord, dim), l (layer1set. check (q) ? 1 : 0)
218{
219 return;
220} /* tCube2l */
int dim() const
Returns the dimension of the cube.
Definition: twolayer.h:251
static hashedset< tCube > layer1set
The set of full-dimensional cubes at layer 1.
Definition: twolayer.h:177
intType * coord(intType *c) const
Fills out the coordinate table with the cube's coordinates.
Definition: twolayer.h:258

◆ tCube2l() [4/6]

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l ( const CoordType coord,
int  dim,
const LayerType _l 
)
inline

The constructor from a table of coordinates and a layer.

Definition at line 223 of file twolayer.h.

224 : q (coord, dim), l (_l)
225{
226 return;
227} /* tCube2l */

◆ tCube2l() [5/6]

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l ( int_t  number,
int  dim 
)
inline

The constructor from a number (if valid for the base class).

Definition at line 230 of file twolayer.h.

231: q (number, dim), l (layer1set. check (q) ? 1 : 0)
232{
233 return;
234} /* tCube2l */

◆ tCube2l() [6/6]

template<class tCube >
chomp::homology::tCube2l< tCube >::tCube2l ( const tCube2l< tCube > &  c)
inline

The copy constructor.

Definition at line 237 of file twolayer.h.

237 : q (c. q), l (c. l)
238{
239 return;
240} /* tCube2l */

Member Function Documentation

◆ coord()

template<class tCube >
template<class intType >
intType * chomp::homology::tCube2l< tCube >::coord ( intType *  c) const
inline

Fills out the coordinate table with the cube's coordinates.

Definition at line 258 of file twolayer.h.

259{
260 return q. coord (c);
261} /* coord */

◆ cube()

template<class tCube >
const tCube & chomp::homology::tCube2l< tCube >::cube
inline

Returns the cube without the layer.

Definition at line 300 of file twolayer.h.

301{
302 return q;
303} /* cube */

◆ dim()

template<class tCube >
int chomp::homology::tCube2l< tCube >::dim
inline

Returns the dimension of the cube.

Definition at line 251 of file twolayer.h.

252{
253 return q. dim ();
254} /* dim */

◆ hashkey1()

template<class tCube >
int_t chomp::homology::tCube2l< tCube >::hashkey1
inline

Returns the hash key no. 1 required by the hashing set template.

Definition at line 264 of file twolayer.h.

265{
266 return q. hashkey1 ();
267} /* hashkey1 */
int_t hashkey1() const
Returns the hash key no. 1 required by the hashing set template.
Definition: twolayer.h:264

References chomp::homology::hashkey1().

◆ hashkey2()

template<class tCube >
int_t chomp::homology::tCube2l< tCube >::hashkey2
inline

Returns the hash key no. 2 required by the hashing set template.

Definition at line 276 of file twolayer.h.

277{
278 return q. hashkey2 () ^ l;
279} /* hashkey2 */
int_t hashkey2() const
Returns the hash key no. 2 required by the hashing set template.
Definition: twolayer.h:276

References chomp::homology::hashkey2().

◆ layer() [1/2]

template<class tCube >
const tCube2l< tCube >::LayerType & chomp::homology::tCube2l< tCube >::layer
inline

Returns the layer number.

Definition at line 306 of file twolayer.h.

308{
309 return l;
310} /* layer */

◆ layer() [2/2]

template<class tCube >
void chomp::homology::tCube2l< tCube >::layer ( const typename tCube2l< tCube >::LayerType newlayer)
inline

Sets the layer number.

Definition at line 313 of file twolayer.h.

315{
316 l = newlayer;
317 return;
318} /* layer */

◆ layer0()

template<class tCube >
const hashedset< tCube > & chomp::homology::tCube2l< tCube >::layer0
inlinestatic

Returns the set of cubes at layer 0 which are neighbors of cubes at layer 1 by the identification of layers.

Definition at line 379 of file twolayer.h.

380{
381 return layer0set;
382} /* layer0 */
static hashedset< tCube > layer0set
The set of full-dimensional cubes at layer 0 which are adjacent to the cubes at layer 1.
Definition: twolayer.h:185

Referenced by chomp::homology::getneighbors_generate(), and chomp::homology::getneighbors_scan().

◆ layer1()

template<class tCube >
const hashedset< tCube > & chomp::homology::tCube2l< tCube >::layer1
inlinestatic

Returns the set of cubes at layer 1.

Definition at line 367 of file twolayer.h.

368{
369 return layer1set;
370} /* layer1 */

Referenced by chomp::homology::getneighbors_generate().

◆ layer1b()

template<class tCube >
const hashedset< tCube > & chomp::homology::tCube2l< tCube >::layer1b
inlinestatic

Returns the set of cubes at the boundary of layer 1.

Definition at line 373 of file twolayer.h.

374{
375 return layer1boundary;
376} /* layer1b */
static hashedset< tCube > layer1boundary
The set of full-dimensional cubes at layer 1 adjacent to cubes at layer 0.
Definition: twolayer.h:181

◆ name()

template<class tCube >
const char * chomp::homology::tCube2l< tCube >::name
inlinestatic

Returns the name of the objects represented by this class.

Definition at line 288 of file twolayer.h.

289{
290 return tCube::name ();
291} /* name */

◆ operator=()

template<class tCube >
tCube2l< tCube > & chomp::homology::tCube2l< tCube >::operator= ( const tCube2l< tCube > &  c)
inline

The assignment operator.

Definition at line 243 of file twolayer.h.

244{
245 q = c. q;
246 l = c. l;
247 return *this;
248} /* tCube2l */

◆ pluralname()

template<class tCube >
const char * chomp::homology::tCube2l< tCube >::pluralname
inlinestatic

Returns the plural name of the objects represented by this class.

Definition at line 294 of file twolayer.h.

295{
296 return tCube::pluralname ();
297} /* pluralname */

◆ setlayers()

template<class tCube >
void chomp::homology::tCube2l< tCube >::setlayers ( const hashedset< tCube > &  X,
const hashedset< tCube > &  A 
)
inlinestatic

Defines the set of cubes at layer 1 (X).

All the other cubes are at layer 0, and the layers are glued along the intersection between X and A. The sets X and A must be disjoint. A should only contain the neighbors of X.

Definition at line 321 of file twolayer.h.

323{
324 // remember the sets at the layers' boundary
325 layer0set = A;
326 layer1set = X;
327 hashedset<tCube> empty;
328 layer1boundary = empty;
329
330 // if the set X is empty, then there is no problem at all
331 if (X. empty ())
332 return;
333
334 // determine the set at Layer 1 as neighbors of A in X,
335 // and create cells at the layers' boundary for identification
336 hashedset<typename tCube::CellType> idcells;
337 for (int_t i = 0; i < X. size (); ++ i)
338 {
339 const tCube &q = X [i];
340 hashedset<tCube> neighbors;
341 int_t ncount = getneighbors (q, 0, layer0set, &neighbors, 0);
342 if (!ncount)
343 continue;
344 layer1boundary. add (q);
345 for (int_t j = 0; j < ncount; ++ j)
346 {
347 idcells. add (typename tCube::CellType
348 (q, neighbors [j]));
349 }
350 }
351
352 // add boundaries of all the cells
353 for (int_t i = 0; i < idcells. size (); ++ i)
354 {
355 const typename tCube::CellType &c = idcells [i];
356 int bsize = boundarylength (c);
357 for (int j = 0; j < bsize; ++ j)
358 idcells. add (boundarycell (c, j));
359 }
360
361 // define the identification set
362 CellType::identify (idcells, layer1set [0]. dim ());
363 return;
364} /* setlayers */
static const hashedset< tCell > & identify()
Returns the set of cells for the identification of layers.
Definition: twolayer.h:799
int int_t
Index type for indexing arrays, counting cubes, etc.
Definition: config.h:115
int_t getneighbors(const tCube &q, BitField *bits, const tCubeSet1 &theset, tCubeSet2 *neighbors, int_t limit)
Gets neighbors of the given cube from the given set and indicates them in the bit field provided.
Definition: neighbor.h:302
tNeighbors< coordinate > neighbors
The neighbors class with the default type of coordinates.
Definition: pointset.h:84
int boundarylength(const tCellBase< coordtype > &q)
Returns the length of the boundary of a cell.
Definition: cellbase.h:501
tCellBase< coordtype > boundarycell(const tCellBase< coordtype > &q, int i, bool onlyexisting)
Computes the i-th boundary element of a cell.
Definition: cellbase.h:485

References chomp::homology::boundarycell(), chomp::homology::boundarylength(), and chomp::homology::getneighbors().

Member Data Documentation

◆ l

template<class tCube >
LayerType chomp::homology::tCube2l< tCube >::l
private

The layer to which the cube belongs.

Definition at line 172 of file twolayer.h.

◆ layer0set

template<class tCube >
hashedset< tCube > chomp::homology::tCube2l< tCube >::layer0set
staticprivate

The set of full-dimensional cubes at layer 0 which are adjacent to the cubes at layer 1.

Definition at line 185 of file twolayer.h.

◆ layer1boundary

template<class tCube >
hashedset< tCube > chomp::homology::tCube2l< tCube >::layer1boundary
staticprivate

The set of full-dimensional cubes at layer 1 adjacent to cubes at layer 0.

Definition at line 181 of file twolayer.h.

◆ layer1set

template<class tCube >
hashedset< tCube > chomp::homology::tCube2l< tCube >::layer1set
staticprivate

The set of full-dimensional cubes at layer 1.

The identification takes place at the boundary of these cubes with the set defined as layer 0.

Definition at line 177 of file twolayer.h.

◆ MaxDim

template<class tCube >
const int chomp::homology::tCube2l< tCube >::MaxDim = tCube::MaxDim
static

The maximal dimension of a cube.

Definition at line 95 of file twolayer.h.

◆ q

template<class tCube >
tCube chomp::homology::tCube2l< tCube >::q
private

The actual cube at the given layer.

Definition at line 169 of file twolayer.h.


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