Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
oomph::Shape Class Reference

A Class for shape functions. In simple cases, the shape functions have only one index that can be thought of as corresponding to the nodal points. In general, however, when quantities and their gradients are interpolated separately, the shape function have two indices: one corresponding to the nodal points, and the other to the "type" of quantity being interpolated: function, derivative, &c The second index can also represent the vector coordinate for vector-valued (Nedelec) shape functions. More...

#include <shape.h>

+ Inheritance diagram for oomph::Shape:

Public Member Functions

 Shape (const unsigned &N)
 Constructor for a single-index set of shape functions.
 
 Shape (const unsigned &N, const unsigned &M)
 Constructor for a two-index set of shape functions.
 
 Shape (const Shape &shape)=delete
 Broken copy constructor.
 
 Shape ()
 Default constructor - just assigns a null pointers and zero index sizes.
 
void operator= (Shape &shape)
 Assignment operator, shallow copy (not recommended so warning given)
 
void operator= (Shape *const &shape_pt)
 Assignment operator, shallow copy (not recommended so warning given)
 
void shallow_copy_from (Shape &shape)
 This function makes a shallow copy (sets the pointer to the allocated data to be from another Shape object)
 
void shallow_copy_from (Shape *const &shape_pt)
 This function make a shallow copy (sets the pointer to the allocated data to be from another Shape object)
 
 ~Shape ()
 Destructor, clear up the memory allocated by the object.
 
double & operator[] (const unsigned &i)
 Overload the bracket operator to provide access to values.
 
const double & operator[] (const unsigned &i) const
 Overload the bracket operator (const version)
 
double & operator() (const unsigned &i)
 Overload the round bracket operator to provide access to values.
 
const double & operator() (const unsigned &i) const
 Overload the round bracket operator (const version)
 
double & operator() (const unsigned &i, const unsigned &j)
 Overload the round bracket operator, allowing for two indices.
 
const double & operator() (const unsigned &i, const unsigned &j) const
 Overload the round bracket operator, allowing for two indices (const version)
 
unsigned nindex1 () const
 Return the range of index 1 of the shape function object.
 
unsigned nindex2 () const
 Return the range of index 2 of the shape function object.
 

Static Public Attributes

static bool Suppress_warning_about_assignment = false
 Boolean used to suppress warning about assignment operator.
 

Protected Member Functions

void range_check (const unsigned &i, const unsigned &j) const
 Private function that checks whether the index is in range.
 

Protected Attributes

double * Psi
 Pointer that addresses the storage that will be used to read and set the shape functions. The shape functions are packed into a flat array of doubles.
 
double * Allocated_storage
 Pointer that addresses the storage allocated by the object on construction. This will be the same as Psi if the object is not copied.
 
unsigned Index1
 Size of the first index of the shape function.
 
unsigned Index2
 Size of the second index of the shape function.
 
bool Is_psi_copied
 Boolean to indicate whether the data has been copied.
 
bool Is_psi_a_copy
 Boolean to indicate whether the data is a copy.
 

Private Member Functions

void resize (const unsigned &N, const unsigned &M=1)
 Change the size of the storage.
 

Detailed Description

A Class for shape functions. In simple cases, the shape functions have only one index that can be thought of as corresponding to the nodal points. In general, however, when quantities and their gradients are interpolated separately, the shape function have two indices: one corresponding to the nodal points, and the other to the "type" of quantity being interpolated: function, derivative, &c The second index can also represent the vector coordinate for vector-valued (Nedelec) shape functions.

The implementation of Shape functions is designed to permit fast copying of entire sets of values by resetting the internal pointer to the data, Psi; functionality that is required, for example, when setting the test functions in Galerkin elements and when reading pre-computed values of the shape functions. In general, we cannot know at construction time whether the pointer to the values will be reset or not and, therefore, whether the storage for values should be allocated by the object. We choose to allocate storage on construction and store an additional pointer Allocated_data that always addresses the storage allocated by the object. If the Psi pointer is reset then this storage will be "wasted", but only for the lifetime of the object. The cost for non-copied Shape functions is one additional pointer.

Definition at line 76 of file shape.h.

Constructor & Destructor Documentation

◆ Shape() [1/4]

oomph::Shape::Shape ( const unsigned &  N)
inline

Constructor for a single-index set of shape functions.

Definition at line 126 of file shape.h.

References Allocated_storage, and Psi.

◆ Shape() [2/4]

oomph::Shape::Shape ( const unsigned &  N,
const unsigned &  M 
)
inline

Constructor for a two-index set of shape functions.

Definition at line 134 of file shape.h.

References Allocated_storage, and Psi.

◆ Shape() [3/4]

oomph::Shape::Shape ( const Shape &  shape)
delete

Broken copy constructor.

◆ Shape() [4/4]

oomph::Shape::Shape ( )
inline

Default constructor - just assigns a null pointers and zero index sizes.

Definition at line 146 of file shape.h.

◆ ~Shape()

oomph::Shape::~Shape ( )
inline

Destructor, clear up the memory allocated by the object.

Definition at line 245 of file shape.h.

References Allocated_storage.

Member Function Documentation

◆ nindex1()

unsigned oomph::Shape::nindex1 ( ) const
inline

Return the range of index 1 of the shape function object.

Definition at line 337 of file shape.h.

References Index1.

◆ nindex2()

unsigned oomph::Shape::nindex2 ( ) const
inline

Return the range of index 2 of the shape function object.

Definition at line 343 of file shape.h.

References Index2.

◆ operator()() [1/4]

double & oomph::Shape::operator() ( const unsigned &  i)
inline

Overload the round bracket operator to provide access to values.

Definition at line 300 of file shape.h.

References i, Index2, Psi, and range_check().

◆ operator()() [2/4]

const double & oomph::Shape::operator() ( const unsigned &  i) const
inline

Overload the round bracket operator (const version)

Definition at line 309 of file shape.h.

References i, Index2, Psi, and range_check().

◆ operator()() [3/4]

double & oomph::Shape::operator() ( const unsigned &  i,
const unsigned &  j 
)
inline

Overload the round bracket operator, allowing for two indices.

Definition at line 318 of file shape.h.

References i, Index2, Psi, and range_check().

◆ operator()() [4/4]

const double & oomph::Shape::operator() ( const unsigned &  i,
const unsigned &  j 
) const
inline

Overload the round bracket operator, allowing for two indices (const version)

Definition at line 328 of file shape.h.

References i, Index2, Psi, and range_check().

◆ operator=() [1/2]

void oomph::Shape::operator= ( Shape &  shape)
inline

Assignment operator, shallow copy (not recommended so warning given)

Definition at line 157 of file shape.h.

References shallow_copy_from(), and Suppress_warning_about_assignment.

◆ operator=() [2/2]

void oomph::Shape::operator= ( Shape *const &  shape_pt)
inline

Assignment operator, shallow copy (not recommended so warning given)

Definition at line 185 of file shape.h.

References shallow_copy_from(), and Suppress_warning_about_assignment.

◆ operator[]() [1/2]

double & oomph::Shape::operator[] ( const unsigned &  i)
inline

Overload the bracket operator to provide access to values.

Definition at line 282 of file shape.h.

References i, Index2, Psi, and range_check().

◆ operator[]() [2/2]

const double & oomph::Shape::operator[] ( const unsigned &  i) const
inline

Overload the bracket operator (const version)

Definition at line 291 of file shape.h.

References i, Index2, Psi, and range_check().

◆ range_check()

void oomph::Shape::range_check ( const unsigned &  i,
const unsigned &  j 
) const
inlineprotected

Private function that checks whether the index is in range.

Definition at line 102 of file shape.h.

References i, Index1, and Index2.

Referenced by operator()(), operator()(), operator()(), operator()(), operator[](), and operator[]().

◆ resize()

void oomph::Shape::resize ( const unsigned &  N,
const unsigned &  M = 1 
)
inlineprivate

Change the size of the storage.

Definition at line 253 of file shape.h.

References Allocated_storage, Index1, Index2, Is_psi_copied, and Psi.

◆ shallow_copy_from() [1/2]

void oomph::Shape::shallow_copy_from ( Shape &  shape)
inline

◆ shallow_copy_from() [2/2]

void oomph::Shape::shallow_copy_from ( Shape *const &  shape_pt)
inline

This function make a shallow copy (sets the pointer to the allocated data to be from another Shape object)

Definition at line 231 of file shape.h.

References Index1, Index2, Is_psi_a_copy, and Psi.

Member Data Documentation

◆ Allocated_storage

double* oomph::Shape::Allocated_storage
protected

Pointer that addresses the storage allocated by the object on construction. This will be the same as Psi if the object is not copied.

Definition at line 87 of file shape.h.

Referenced by resize(), Shape(), Shape(), and ~Shape().

◆ Index1

unsigned oomph::Shape::Index1
protected

Size of the first index of the shape function.

Definition at line 90 of file shape.h.

Referenced by nindex1(), range_check(), resize(), shallow_copy_from(), and shallow_copy_from().

◆ Index2

unsigned oomph::Shape::Index2
protected

Size of the second index of the shape function.

Definition at line 93 of file shape.h.

Referenced by nindex2(), operator()(), operator()(), operator()(), operator()(), operator[](), operator[](), range_check(), resize(), shallow_copy_from(), and shallow_copy_from().

◆ Is_psi_a_copy

bool oomph::Shape::Is_psi_a_copy
protected

Boolean to indicate whether the data is a copy.

Definition at line 99 of file shape.h.

Referenced by shallow_copy_from(), and shallow_copy_from().

◆ Is_psi_copied

bool oomph::Shape::Is_psi_copied
protected

Boolean to indicate whether the data has been copied.

Definition at line 96 of file shape.h.

Referenced by resize().

◆ Psi

double* oomph::Shape::Psi
protected

Pointer that addresses the storage that will be used to read and set the shape functions. The shape functions are packed into a flat array of doubles.

Definition at line 82 of file shape.h.

Referenced by operator()(), operator()(), operator()(), operator()(), operator[](), operator[](), resize(), shallow_copy_from(), shallow_copy_from(), Shape(), and Shape().

◆ Suppress_warning_about_assignment

bool oomph::Shape::Suppress_warning_about_assignment = false
static

Boolean used to suppress warning about assignment operator.

Definition at line 349 of file shape.h.

Referenced by operator=(), and operator=().


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