escript  Revision_
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
ripley::Brick Class Reference

Brick is the 3-dimensional implementation of a RipleyDomain. More...

#include <Brick.h>

Inheritance diagram for ripley::Brick:
ripley::RipleyDomain escript::AbstractContinuousDomain escript::AbstractDomain

List of all members.

Public Member Functions

 Brick (int n0, int n1, int n2, double x0, double y0, double z0, double x1, double y1, double z1, int d0=-1, int d1=-1, int d2=-1, const std::vector< double > &points=std::vector< double >(), const std::vector< int > &tags=std::vector< int >(), const simap_t &tagnamestonums=simap_t())
 creates a hexagonal mesh with n0 x n1 x n2 elements over the brick [x0,x1] x [y0,y1] x [z0,z1].
 ~Brick ()
 Destructor.
virtual std::string getDescription () const
 returns a description for this domain
virtual bool operator== (const escript::AbstractDomain &other) const
 equality operator
void dump (const std::string &filename) const
 dumps the mesh to a file with the given name
virtual void readNcGrid (escript::Data &out, std::string filename, std::string varname, const ReaderParameters &params) const
virtual void readBinaryGrid (escript::Data &out, std::string filename, const ReaderParameters &params) const
virtual void writeBinaryGrid (const escript::Data &in, std::string filename, int byteOrder, int dataType) const
const int * borrowSampleReferenceIDs (int fsType) const
 returns the reference number of the given sample number
virtual bool ownSample (int fsType, index_t id) const
 returns true if this rank owns the sample id.
virtual void setToNormal (escript::Data &out) const
 copies the surface normals at data points into out. The actual function space to be considered is defined by out. out has to be defined on this domain.
virtual void setToSize (escript::Data &out) const
 copies the size of samples into out. The actual function space to be considered is defined by out. out has to be defined on this domain.
virtual int getNumDataPointsGlobal () const
 returns the number of data points summed across all MPI processes
virtual void Print_Mesh_Info (const bool full=false) const
 writes information about the mesh to standard output
virtual const int * getNumNodesPerDim () const
 returns the number of nodes per MPI rank in each dimension
virtual const int * getNumElementsPerDim () const
 returns the number of elements per MPI rank in each dimension
virtual const int * getNumFacesPerBoundary () const
 returns the number of face elements in the order (left,right,bottom,top,front,back) on current MPI rank
virtual IndexVector getNodeDistribution () const
 returns the node distribution vector
virtual const int * getNumSubdivisionsPerDim () const
 returns the number of spatial subdivisions in each dimension
virtual double getLocalCoordinate (int index, int dim) const
 returns the index'th coordinate value in given dimension for this rank
virtual boost::python::tuple getGridParameters () const
 returns the tuple (origin, spacing, number_of_elements)
virtual escript::Data randomFill (const escript::DataTypes::ShapeType &shape, const escript::FunctionSpace &what, long seed, const boost::python::tuple &filter) const
 Returns a Data object filled with random data passed through filter.

Protected Member Functions

virtual dim_t getNumNodes () const
 returns the number of nodes per MPI rank
virtual dim_t getNumElements () const
 returns the number of elements per MPI rank
virtual dim_t getNumFaceElements () const
 returns the number of face elements on current MPI rank
virtual dim_t getNumDOF () const
 returns the number of degrees of freedom per MPI rank
virtual dim_t insertNeighbourNodes (IndexVector &index, index_t node) const
virtual void assembleCoordinates (escript::Data &arg) const
 populates the data object 'arg' with the node coordinates
virtual void assembleGradient (escript::Data &out, const escript::Data &in) const
 computes the gradient of 'in' and puts the result in 'out'
virtual void assembleIntegrate (DoubleVector &integrals, const escript::Data &arg) const
 copies the integrals of the function defined by 'arg' into 'integrals'
virtual
paso::SystemMatrixPattern_ptr 
getPattern (bool reducedRowOrder, bool reducedColOrder) const
 returns the Paso system matrix pattern
virtual void interpolateNodesOnElements (escript::Data &out, const escript::Data &in, bool reduced) const
 interpolates data on nodes in 'in' onto (reduced) elements in 'out'
virtual void interpolateNodesOnFaces (escript::Data &out, const escript::Data &in, bool reduced) const
 interpolates data on nodes in 'in' onto (reduced) face elements in 'out'
virtual void nodesToDOF (escript::Data &out, const escript::Data &in) const
 converts data on nodes in 'in' to degrees of freedom in 'out'
virtual void dofToNodes (escript::Data &out, const escript::Data &in) const
 converts data on degrees of freedom in 'in' to nodes in 'out'
virtual int getDofOfNode (int node) const
void setAssembler (std::string type, std::map< std::string, escript::Data > constants)

Private Member Functions

void populateSampleIds ()
void createPattern ()
void addToMatrixAndRHS (paso::SystemMatrix_ptr S, escript::Data &F, const DoubleVector &EM_S, const DoubleVector &EM_F, bool addS, bool addF, int firstNode, int nEq=1, int nComp=1) const
template<typename ValueType >
void readBinaryGridImpl (escript::Data &out, const std::string &filename, const ReaderParameters &params) const
template<typename ValueType >
void readBinaryGridZippedImpl (escript::Data &out, const std::string &filename, const ReaderParameters &params) const
template<typename ValueType >
void writeBinaryGridImpl (const escript::Data &in, const std::string &filename, int byteOrder) const
int findNode (const double *coords) const
virtual escript::Data randomFillWorker (const escript::DataTypes::ShapeType &shape, long seed, const boost::python::tuple &filter) const

Private Attributes

dim_t m_gNE [3]
 total number of elements in each dimension
double m_origin [3]
 origin of domain
double m_length [3]
 side lengths of domain
double m_dx [3]
 grid spacings / cell sizes of domain
int m_NX [3]
 number of spatial subdivisions
dim_t m_NE [3]
 number of elements for this rank in each dimension including shared
dim_t m_ownNE [3]
 number of own elements for this rank in each dimension
dim_t m_NN [3]
 number of nodes for this rank in each dimension
dim_t m_offset [3]
 first node on this rank is at (offset0,offset1,offset2) in global mesh
int m_faceCount [6]
 number of face elements per edge (left, right, bottom, top, front, back)
IndexVector m_faceOffset
IndexVector m_dofId
 vector of sample reference identifiers
IndexVector m_nodeId
IndexVector m_elementId
IndexVector m_faceId
IndexVector m_nodeDistribution
IndexVector m_dofMap
paso::Connector_ptr m_connector
paso::SystemMatrixPattern_ptr m_pattern

Friends

class DefaultAssembler3D
class WaveAssembler3D
class LameAssembler3D

Detailed Description

Brick is the 3-dimensional implementation of a RipleyDomain.


Constructor & Destructor Documentation

ripley::Brick::Brick ( int  n0,
int  n1,
int  n2,
double  x0,
double  y0,
double  z0,
double  x1,
double  y1,
double  z1,
int  d0 = -1,
int  d1 = -1,
int  d2 = -1,
const std::vector< double > &  points = std::vector<double>(),
const std::vector< int > &  tags = std::vector<int>(),
const simap_t tagnamestonums = simap_t() 
)

creates a hexagonal mesh with n0 x n1 x n2 elements over the brick [x0,x1] x [y0,y1] x [z0,z1].

Parameters:
n0,n1,n2number of elements in each dimension
x0,y0,z0,x1,y1,z1coordinates of corner nodes of the brick
d0,d1,d2number of subdivisions in each dimension

References ripley::RipleyDomain::addPoints(), ripley::RipleyDomain::assembler, createPattern(), DefaultAssembler3D, factorise(), ripley::indexOfMax(), paso::util::l2(), m_dx, m_gNE, m_length, ripley::RipleyDomain::m_mpiInfo, m_NE, m_NN, m_NX, m_offset, m_origin, m_ownNE, populateSampleIds(), Esys_MPIInfo::rank, ripley::RipleyDomain::setTagMap(), and Esys_MPIInfo::size.

Destructor.

References ripley::RipleyDomain::assembler.


Member Function Documentation

void ripley::Brick::addToMatrixAndRHS ( paso::SystemMatrix_ptr  S,
escript::Data F,
const DoubleVector EM_S,
const DoubleVector EM_F,
bool  addS,
bool  addF,
int  firstNode,
int  nEq = 1,
int  nComp = 1 
) const [private]
void ripley::Brick::assembleCoordinates ( escript::Data arg) const [protected, virtual]
void ripley::Brick::assembleGradient ( escript::Data out,
const escript::Data in 
) const [protected, virtual]
void ripley::Brick::assembleIntegrate ( DoubleVector integrals,
const escript::Data arg 
) const [protected, virtual]
const int * ripley::Brick::borrowSampleReferenceIDs ( int  fsType) const [virtual]
void ripley::Brick::createPattern ( ) [private]
void ripley::Brick::dofToNodes ( escript::Data out,
const escript::Data in 
) const [protected, virtual]
void ripley::Brick::dump ( const std::string &  filename) const [virtual]

dumps the mesh to a file with the given name

Parameters:
filenameThe name of the output file

Implements ripley::RipleyDomain.

References Esys_MPIInfo::comm, getDescription(), getLocalCoordinate(), getNumElementsPerDim(), getNumNodesPerDim(), m_elementId, ripley::RipleyDomain::m_mpiInfo, m_NN, m_nodeId, Esys_MPIInfo::rank, and Esys_MPIInfo::size.

int ripley::Brick::findNode ( const double *  coords) const [private, virtual]
string ripley::Brick::getDescription ( ) const [virtual]

returns a description for this domain

Implements ripley::RipleyDomain.

Referenced by dump().

int ripley::Brick::getDofOfNode ( int  node) const [inline, protected, virtual]

Implements ripley::RipleyDomain.

References m_dofMap.

boost::python::tuple ripley::Brick::getGridParameters ( ) const [inline, virtual]

returns the tuple (origin, spacing, number_of_elements)

Implements ripley::RipleyDomain.

References m_dx, m_gNE, and m_origin.

double ripley::Brick::getLocalCoordinate ( int  index,
int  dim 
) const [inline, virtual]

returns the index'th coordinate value in given dimension for this rank

Implements ripley::RipleyDomain.

References EsysAssert, m_dx, m_NN, m_offset, and m_origin.

Referenced by assembleCoordinates(), dump(), and Print_Mesh_Info().

virtual IndexVector ripley::Brick::getNodeDistribution ( ) const [inline, virtual]

returns the node distribution vector

Implements ripley::RipleyDomain.

int ripley::Brick::getNumDataPointsGlobal ( ) const [inline, virtual]

returns the number of data points summed across all MPI processes

Implements ripley::RipleyDomain.

References m_gNE.

Referenced by populateSampleIds().

dim_t ripley::Brick::getNumDOF ( ) const [inline, protected, virtual]

returns the number of degrees of freedom per MPI rank

Implements ripley::RipleyDomain.

References m_gNE, and m_NX.

Referenced by addToMatrixAndRHS(), dofToNodes(), ownSample(), and populateSampleIds().

dim_t ripley::Brick::getNumElements ( ) const [inline, protected, virtual]

returns the number of elements per MPI rank

Implements ripley::RipleyDomain.

References m_NE.

Referenced by populateSampleIds(), and setToSize().

virtual const int* ripley::Brick::getNumElementsPerDim ( ) const [inline, virtual]

returns the number of elements per MPI rank in each dimension

Implements ripley::RipleyDomain.

Referenced by dump().

dim_t ripley::Brick::getNumFaceElements ( ) const [inline, protected, virtual]

returns the number of face elements on current MPI rank

Implements ripley::RipleyDomain.

References m_faceCount.

Referenced by populateSampleIds().

virtual const int* ripley::Brick::getNumFacesPerBoundary ( ) const [inline, virtual]

returns the number of face elements in the order (left,right,bottom,top,front,back) on current MPI rank

Implements ripley::RipleyDomain.

dim_t ripley::Brick::getNumNodes ( ) const [inline, protected, virtual]

returns the number of nodes per MPI rank

Implements ripley::RipleyDomain.

References m_NN.

Referenced by assembleCoordinates(), createPattern(), dofToNodes(), populateSampleIds(), and Print_Mesh_Info().

virtual const int* ripley::Brick::getNumNodesPerDim ( ) const [inline, virtual]

returns the number of nodes per MPI rank in each dimension

Implements ripley::RipleyDomain.

Referenced by dump().

virtual const int* ripley::Brick::getNumSubdivisionsPerDim ( ) const [inline, virtual]

returns the number of spatial subdivisions in each dimension

Implements ripley::RipleyDomain.

paso::SystemMatrixPattern_ptr ripley::Brick::getPattern ( bool  reducedRowOrder,
bool  reducedColOrder 
) const [inline, protected, virtual]

returns the Paso system matrix pattern

Implements ripley::RipleyDomain.

References m_pattern.

dim_t ripley::Brick::insertNeighbourNodes ( IndexVector index,
index_t  node 
) const [protected, virtual]

inserts the nodes that share an element with 'node' into 'index' and returns the number of these neighbours

Implements ripley::RipleyDomain.

References m_gNE, m_NX, and paso::nz.

void ripley::Brick::interpolateNodesOnElements ( escript::Data out,
const escript::Data in,
bool  reduced 
) const [protected, virtual]

interpolates data on nodes in 'in' onto (reduced) elements in 'out'

Implements ripley::RipleyDomain.

References escript::Data::getDataPointSize(), escript::Data::getSampleDataRO(), escript::Data::getSampleDataRW(), INDEX2, INDEX3, m_NE, m_NN, and escript::Data::requireWrite().

void ripley::Brick::interpolateNodesOnFaces ( escript::Data out,
const escript::Data in,
bool  reduced 
) const [protected, virtual]

interpolates data on nodes in 'in' onto (reduced) face elements in 'out'

Implements ripley::RipleyDomain.

References escript::Data::getDataPointSize(), escript::Data::getSampleDataRO(), escript::Data::getSampleDataRW(), INDEX2, INDEX3, m_faceOffset, m_NE, m_NN, and escript::Data::requireWrite().

void ripley::Brick::nodesToDOF ( escript::Data out,
const escript::Data in 
) const [protected, virtual]
bool ripley::Brick::operator== ( const escript::AbstractDomain other) const [virtual]

equality operator

Reimplemented from ripley::RipleyDomain.

References m_gNE, m_length, m_NX, and m_origin.

bool ripley::Brick::ownSample ( int  fsType,
index_t  id 
) const [virtual]
void ripley::Brick::Print_Mesh_Info ( const bool  full = false) const [virtual]

writes information about the mesh to standard output

Parameters:
fullwhether to print additional data

Reimplemented from ripley::RipleyDomain.

References getLocalCoordinate(), getNumNodes(), m_NN, and m_nodeId.

escript::Data ripley::Brick::randomFill ( const escript::DataTypes::ShapeType shape,
const escript::FunctionSpace what,
long  seed,
const boost::python::tuple &  filter 
) const [virtual]

Returns a Data object filled with random data passed through filter.

Implements escript::AbstractDomain.

References escript::Data::getFunctionSpace(), escript::DataTypes::noValues(), and randomFillWorker().

escript::Data ripley::Brick::randomFillWorker ( const escript::DataTypes::ShapeType shape,
long  seed,
const boost::python::tuple &  filter 
) const [private, virtual]
void ripley::Brick::readBinaryGrid ( escript::Data out,
std::string  filename,
const ReaderParameters params 
) const [virtual]
template<typename ValueType >
void ripley::Brick::readBinaryGridImpl ( escript::Data out,
const std::string &  filename,
const ReaderParameters params 
) const [private]
template<typename ValueType >
void ripley::Brick::readBinaryGridZippedImpl ( escript::Data out,
const std::string &  filename,
const ReaderParameters params 
) const [private]
void ripley::Brick::readNcGrid ( escript::Data out,
std::string  filename,
std::string  varname,
const ReaderParameters params 
) const [virtual]
void ripley::Brick::setAssembler ( std::string  type,
std::map< std::string, escript::Data constants 
) [protected, virtual]
void ripley::Brick::setToNormal ( escript::Data out) const [virtual]

copies the surface normals at data points into out. The actual function space to be considered is defined by out. out has to be defined on this domain.

Implements ripley::RipleyDomain.

References ripley::FaceElements, escript::Data::getFunctionSpace(), escript::Data::getSampleDataRW(), escript::FunctionSpace::getTypeCode(), INDEX2, m_faceOffset, m_NE, ripley::ReducedFaceElements, and escript::Data::requireWrite().

void ripley::Brick::setToSize ( escript::Data out) const [virtual]
void ripley::Brick::writeBinaryGrid ( const escript::Data in,
std::string  filename,
int  byteOrder,
int  dataType 
) const [virtual]
template<typename ValueType >
void ripley::Brick::writeBinaryGridImpl ( const escript::Data in,
const std::string &  filename,
int  byteOrder 
) const [private]

Friends And Related Function Documentation

friend class DefaultAssembler3D [friend]

Referenced by Brick().

friend class LameAssembler3D [friend]

Referenced by setAssembler().

friend class WaveAssembler3D [friend]

Referenced by setAssembler().


Member Data Documentation

Referenced by createPattern(), and dofToNodes().

vector of sample reference identifiers

Referenced by borrowSampleReferenceIDs(), and populateSampleIds().

double ripley::Brick::m_dx[3] [private]
int ripley::Brick::m_faceCount[6] [private]

number of face elements per edge (left, right, bottom, top, front, back)

Referenced by getNumFaceElements(), ownSample(), and populateSampleIds().

faceOffset[i]=-1 if face i is not an external face, otherwise it is the index of that face (where i: 0=left, 1=right, 2=bottom, 3=top, 4=front, 5=back)

Referenced by assembleGradient(), assembleIntegrate(), interpolateNodesOnFaces(), populateSampleIds(), setToNormal(), and setToSize().

double ripley::Brick::m_length[3] [private]

side lengths of domain

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

dim_t ripley::Brick::m_NE[3] [private]
dim_t ripley::Brick::m_NN[3] [private]

Referenced by createPattern(), and populateSampleIds().

int ripley::Brick::m_NX[3] [private]

first node on this rank is at (offset0,offset1,offset2) in global mesh

Referenced by assembleIntegrate(), Brick(), createPattern(), findNode(), getLocalCoordinate(), nodesToDOF(), populateSampleIds(), readBinaryGridImpl(), readNcGrid(), and writeBinaryGridImpl().

double ripley::Brick::m_origin[3] [private]

origin of domain

Referenced by Brick(), findNode(), getGridParameters(), getLocalCoordinate(), and operator==().

number of own elements for this rank in each dimension

Referenced by assembleIntegrate(), and Brick().

Referenced by createPattern(), and getPattern().


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