MultiRectangle.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2017 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014 by Centre for Geoscience Computing (GeoComp)
*
*****************************************************************************/
#ifndef __RIPLEY_MULTIRECTANGLE_H__
#define __RIPLEY_MULTIRECTANGLE_H__
#include <ripley/Rectangle.h>
namespace ripley {
class RIPLEY_DLL_API MultiRectangle: public Rectangle
{
template<class Scalar> friend class DefaultAssembler2D;
friend class WaveAssembler2D;
friend class LameAssembler2D;
public:
MultiRectangle(dim_t n0, dim_t n1, double x0, double y0, double x1, double y1,
int d0=-1, int d1=-1,
const std::vector<double>& points = std::vector<double>(),
const std::vector<int>& tags = std::vector<int>(),
const TagMap& tagnamestonums = TagMap(),
escript::SubWorld_ptr w=escript::SubWorld_ptr(),
unsigned int subdivisions = 1
);
~MultiRectangle();
virtual void interpolateAcross(escript::Data& target,
const escript::Data& source) const;
void validateInterpolationAcross(int fsType_source,
const escript::AbstractDomain& domain, int fsType_target) const;
virtual std::string getDescription() const;
virtual bool operator==(const escript::AbstractDomain& other) const;
void dump(const std::string& filename) const;
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 readBinaryGridFromZipped(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;
virtual unsigned int getNumSubdivisionsPerElement() const { return m_subdivisions; }
virtual RankVector getOwnerVector(int fsType) const;
protected:
virtual void interpolateNodesToNodesFiner(const escript::Data& source, escript::Data& target, const MultiRectangle& other) const;
virtual void interpolateNodesToElementsFiner(const escript::Data& source, escript::Data& target, const MultiRectangle& other) const;
virtual void interpolateElementsToElementsCoarser(const escript::Data& source, escript::Data& target, const MultiRectangle& other) const;
virtual void interpolateElementsToElementsFiner(const escript::Data& source, escript::Data& target, const MultiRectangle& other) const;
virtual void interpolateReducedToElementsFiner(const escript::Data& source, escript::Data& target, const MultiRectangle& other) const;
virtual void interpolateReducedToReducedFiner(const escript::Data& source, escript::Data& target, const MultiRectangle& other) const;
#ifdef ESYS_HAVE_PASO
virtual paso::SystemMatrixPattern_ptr getPasoMatrixPattern(
bool reducedRowOrder,
bool reducedColOrder) const;
#endif
virtual index_t getFirstInDim(unsigned axis) const;
virtual void populateSampleIds();
virtual dim_t getNumDOFInAxis(unsigned axis) const;
virtual dim_t getNumDOF() const;
virtual void populateDofMap();
virtual dim_t findNode(const double *coords) const;
private:
mutable std::vector<IndexVector> m_colIndices;
mutable std::vector<IndexVector> m_rowIndices;
unsigned int m_subdivisions;
template <typename S>
void interpolateNodesToNodesFinerWorker(const escript::Data& source, escript::Data& target, const MultiRectangle& other, S sentinel) const;
template <typename S>
void interpolateNodesToElementsFinerWorker(const escript::Data& source, escript::Data& target, const MultiRectangle& other, S sentinel) const;
template <typename S>
void interpolateElementsToElementsCoarserWorker(const escript::Data& source, escript::Data& target, const MultiRectangle& other, S sentinel) const;
template <typename S>
void interpolateElementsToElementsFinerWorker(const escript::Data& source, escript::Data& target, const MultiRectangle& other, S sentinel) const;
template <typename S>
void interpolateReducedToElementsFinerWorker(const escript::Data& source, escript::Data& target, const MultiRectangle& other, S sentinel) const;
template <typename S>
void interpolateReducedToReducedFinerWorker(const escript::Data& source, escript::Data& target, const MultiRectangle& other, S sentinel) const;
};
//protected
inline dim_t MultiRectangle::getNumDOF() const
{
return getNumDOFInAxis(0)*getNumDOFInAxis(1);
}
//protected
inline dim_t MultiRectangle::getNumDOFInAxis(unsigned axis) const
{
ESYS_ASSERT(axis < m_numDim, "Invalid axis");
dim_t res = m_ownNE[axis] + 1;
if (m_offset[axis] + m_NE[axis] < m_gNE[axis]) {
res--;
}
return res;
}
//protected
index_t MultiRectangle::getFirstInDim(unsigned axis) const
{
return m_offset[axis] == 0 ? 0 : m_subdivisions;
}
} // end of namespace ripley
#endif // __RIPLEY_MULTIRECTANGLE_H__
ripley::MultiRectangle
Rectangle is the 2-dimensional implementation of a RipleyDomain.
Definition: MultiRectangle.h:28
ripley::RankVector
std::vector< int > RankVector
Definition: Ripley.h:45
ripley::readNcGrid
escript::Data readNcGrid(std::string filename, std::string varname, escript::FunctionSpace fs, const object &pyShape, double fill, const object &pyFirst, const object &pyNum, const object &pyMultiplier, const object &pyReverse)
Definition: ripleycpp.cpp:116
ripley::WaveAssembler2D
Definition: ripley/src/WaveAssembler2D.h:24
ripley::LameAssembler2D
Definition: LameAssembler2D.h:24
ripley::MultiRectangle::m_rowIndices
std::vector< IndexVector > m_rowIndices
Definition: MultiRectangle.h:147
ripley::MultiRectangle::getNumDOF
virtual dim_t getNumDOF() const
returns the number of degrees of freedom per MPI rank
Definition: MultiRectangle.h:170
ripley::DefaultAssembler2D
Definition: ripley/src/DefaultAssembler2D.h:24
ripley::readBinaryGrid
escript::Data readBinaryGrid(std::string filename, escript::FunctionSpace fs, const object &pyShape, double fill, int byteOrder, int dataType, const object &pyFirst, const object &pyNum, const object &pyMultiplier, const object &pyReverse)
Definition: ripleycpp.cpp:62
paso::SystemMatrixPattern_ptr
boost::shared_ptr< SystemMatrixPattern > SystemMatrixPattern_ptr
Definition: SystemMatrixPattern.h:39
ripley::TagMap
std::map< std::string, int > TagMap
Definition: Ripley.h:46
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:59
ripley::Rectangle
Rectangle is the 2-dimensional implementation of a RipleyDomain.
Definition: ripley/src/Rectangle.h:28
ripley::MultiRectangle::getNumDOFInAxis
virtual dim_t getNumDOFInAxis(unsigned axis) const
Definition: MultiRectangle.h:176
escript::SubWorld_ptr
boost::shared_ptr< SubWorld > SubWorld_ptr
Definition: SubWorld.h:146
ripley::ReaderParameters
Structure that wraps parameters for the grid reading routines.
Definition: ripley/src/RipleyDomain.h:68
ripley::MultiRectangle::getFirstInDim
virtual index_t getFirstInDim(unsigned axis) const
Definition: MultiRectangle.h:187
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:63
ripley::MultiRectangle::getNumSubdivisionsPerElement
virtual unsigned int getNumSubdivisionsPerElement() const
returns the number of times each root element has been subdivided
Definition: MultiRectangle.h:114
ripley
Definition: ripley/src/AbstractAssembler.h:25
ripley::readBinaryGridFromZipped
escript::Data readBinaryGridFromZipped(std::string filename, escript::FunctionSpace fs, const object &pyShape, double fill, int byteOrder, int dataType, const object &pyFirst, const object &pyNum, const object &pyMultiplier, const object &pyReverse)
Definition: ripleycpp.cpp:87
ripley::MultiRectangle::m_subdivisions
unsigned int m_subdivisions
Definition: MultiRectangle.h:148
escript::AbstractDomain
Base class for all escript domains.
Definition: AbstractDomain.h:45
ESYS_ASSERT
#define ESYS_ASSERT(a, b)
EsysAssert is a MACRO that will throw an exception if the boolean condition specified is false...
Definition: Assert.h:78
RIPLEY_DLL_API
#define RIPLEY_DLL_API
Definition: ripley/src/system_dep.h:20
S
#define S(_J_, _I_)
Definition: ShapeFunctions.cpp:121
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:64
ripley::MultiRectangle::m_colIndices
std::vector< IndexVector > m_colIndices
Definition: MultiRectangle.h:146