CrossDomainCoupler.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2020 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-2017 by Centre for Geoscience Computing (GeoComp)
* Development from 2019 by School of Earth and Environmental Sciences
**
*****************************************************************************/
#ifndef __SPECKLEY_CROSSDOMAINCOUPLER_H__
#define __SPECKLEY_CROSSDOMAINCOUPLER_H__
#include <speckley/Brick.h>
#include <speckley/Rectangle.h>
#include <ripley/Brick.h>
#include <ripley/Rectangle.h>
namespace speckley {
class RipleyCoupler {
public:
RipleyCoupler(const SpeckleyDomain *speck, const double s_dx[2], int rank);
void interpolate(escript::Data& target, const escript::Data& source) const;
private:
// a struct type to hold all the relevant info on the target domain
struct Ripley {
const ripley::RipleyDomain *domain;
double dx[3];
dim_t NE[3];
dim_t mins[3];
dim_t maxs[3];
};
void calculateOrder2(int dim, double loc, double *results) const;
void calculateOrder3(int dim, double loc, double *results) const;
void calculateOrder4(int dim, double loc, double *results) const;
void calculateOrder5(int dim, double loc, double *results) const;
void calculateOrder6(int dim, double loc, double *results) const;
void calculateOrder7(int dim, double loc, double *results) const;
void calculateOrder8(int dim, double loc, double *results) const;
void calculateOrder9(int dim, double loc, double *results) const;
void calculateOrder10(int dim, double loc, double *results) const;
void generateLocations(struct Ripley& r, double **positions) const;
bool validInterpolation(escript::Data& target, const escript::Data& source,
const SpeckleyDomain *speck, const double *s_dx,
const ripley::RipleyDomain *other) const;
void calculate(struct Ripley& r, dim_t ex, dim_t ey, dim_t ez,
int oqx, int oqy, int oqz, double *out, const double *factor_x,
const double *factor_y, const double *factor_z,
const escript::Data& source) const;
void shareWithNeighbours(bool lowerFirst, int hasLower, int hasUpper,
double *bottom, double *top, double *brecv, double *trecv,
int bSize, int tSize, int distance) const;
void getEdgeSpacing(struct Ripley r, int *lower, int *upper) const;
void shareBrickXFaces(struct Ripley& r, int hasLower,
int hasUpper, int lower, int upper, escript::Data& target) const;
void shareBrickYFaces(struct Ripley& r, int hasLower,
int hasUpper, int lower, int upper, escript::Data& target) const;
void shareBrickZFaces(struct Ripley& r, int hasLower,
int hasUpper, int lower, int upper, escript::Data& target) const;
void shareRectangleXEdges(struct Ripley& r, int hasLower,
int hasUpper, int lower, int upper, escript::Data& target) const;
void shareRectangleYEdges(struct Ripley& r, int hasLower,
int hasUpper, int lower, int upper, escript::Data& target) const;
//speckley info
const SpeckleyDomain *speck;
dim_t s_NE[3];
double s_dx[3];
int s_NX[3];
double speckley_origin[3];
int order;
int numQuads;
//coupling info
bool hasLower[3];
bool hasUpper[3];
//per interpolation
mutable int numComp;
#ifdef ESYS_MPI
int rank;
MPI_Comm comm;
#endif
};
void interpolateAcross3D(escript::Data& target, const escript::Data& source,
const Brick *speck, const double s_dx[3], int rank,
MPI_Comm comm);
bool probeInterpolationAcross(int fsType_source,
const escript::AbstractDomain& domain, int fsType_target, int dim);
} // end of namespace speckley
#endif // __SPECKLEY_CROSSDOMAINCOUPLER_H__
speckley::lagrange_degree10_7
double lagrange_degree10_7(double xi)
Definition: lagrange_functions.h:270
speckley::RipleyCoupler::Ripley::dx
double dx[3]
Definition: CrossDomainCoupler.h:67
speckley::lagrange_degree9_3
double lagrange_degree9_3(double xi)
Definition: lagrange_functions.h:214
speckley::lagrange_degree10_3
double lagrange_degree10_3(double xi)
Definition: lagrange_functions.h:254
speckley::RipleyCoupler::shareBrickZFaces
void shareBrickZFaces(struct Ripley &r, int hasLower, int hasUpper, int lower, int upper, escript::Data &target) const
Definition: CrossDomainCoupler.cpp:753
MPI_Status
int MPI_Status
Definition: EsysMPI.h:45
speckley::lagrange_degree9_8
double lagrange_degree9_8(double xi)
Definition: lagrange_functions.h:234
speckley::RipleyCoupler::Ripley::mins
dim_t mins[3]
Definition: CrossDomainCoupler.h:69
speckley::RipleyCoupler::hasUpper
bool hasUpper[3]
Definition: CrossDomainCoupler.h:120
speckley::RipleyCoupler::s_dx
double s_dx[3]
Definition: CrossDomainCoupler.h:112
speckley::lagrange_degree8_2
double lagrange_degree8_2(double xi)
Definition: lagrange_functions.h:174
speckley::lagrange_degree10_1
double lagrange_degree10_1(double xi)
Definition: lagrange_functions.h:246
ripley::RipleyDomain::getMPIComm
MPI_Comm getMPIComm() const
returns the MPI communicator
Definition: ripley/src/RipleyDomain.h:172
speckley::RipleyCoupler::RipleyCoupler
RipleyCoupler(const SpeckleyDomain *speck, const double s_dx[2], int rank)
Definition: CrossDomainCoupler.cpp:46
speckley::SpeckleyDomain::getLocalCoordinate
virtual double getLocalCoordinate(dim_t index, int dim) const =0
returns the index'th coordinate value in given dimension for this rank
speckley::RipleyCoupler::speck
const SpeckleyDomain * speck
Definition: CrossDomainCoupler.h:110
speckley::lagrange_degree9_2
double lagrange_degree9_2(double xi)
Definition: lagrange_functions.h:210
escript::Data::requireWrite
void requireWrite()
Ensures data is ready for write access. This means that the data will be resolved if lazy and will be...
Definition: Data.cpp:1239
speckley::lagrange_degree10_4
double lagrange_degree10_4(double xi)
Definition: lagrange_functions.h:258
speckley::lagrange_degree4_1
double lagrange_degree4_1(double xi)
Definition: lagrange_functions.h:66
speckley::RipleyCoupler::hasLower
bool hasLower[3]
Definition: CrossDomainCoupler.h:119
INDEX4
#define INDEX4(_X1_, _X2_, _X3_, _X4_, _N1_, _N2_, _N3_)
Definition: index.h:27
speckley::ripleyLocations
const double ripleyLocations[2]
Definition: CrossDomainCoupler.cpp:30
speckley::interpolateAcross3D
void interpolateAcross3D(escript::Data &target, const escript::Data &source, const Brick *speck, const double s_dx[3], int rank, MPI_Comm comm)
interpolates data given on source onto target where source and target are given on different domains
speckley::lagrange_degree4_2
double lagrange_degree4_2(double xi)
Definition: lagrange_functions.h:70
speckley::lagrange_degree8_0
double lagrange_degree8_0(double xi)
Definition: lagrange_functions.h:166
speckley::lagrange_degree8_1
double lagrange_degree8_1(double xi)
Definition: lagrange_functions.h:170
INDEX2
#define INDEX2(_X1_, _X2_, _N1_)
Definition: index.h:23
speckley::RipleyCoupler::calculateOrder7
void calculateOrder7(int dim, double loc, double *results) const
Definition: CrossDomainCoupler.cpp:319
speckley::RipleyCoupler::calculateOrder9
void calculateOrder9(int dim, double loc, double *results) const
Definition: CrossDomainCoupler.cpp:350
escript::Data::getDomain
const_Domain_ptr getDomain() const
Return the domain.
Definition: Data.h:487
speckley::RipleyCoupler::calculateOrder10
void calculateOrder10(int dim, double loc, double *results) const
Definition: CrossDomainCoupler.cpp:367
ripley::RipleyDomain::getElementLength
virtual const double * getElementLength() const =0
returns the lengths of an element
escript::Data::getSampleDataRO
const DataTypes::real_t * getSampleDataRO(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0) const
Return the sample data for the given sample no. Please do not use this unless you NEED to access samp...
Definition: Data.h:1989
speckley::lagrange_degree7_4
double lagrange_degree7_4(double xi)
Definition: lagrange_functions.h:150
speckley::lagrange_degree8_3
double lagrange_degree8_3(double xi)
Definition: lagrange_functions.h:178
speckley::RipleyCoupler::order
int order
Definition: CrossDomainCoupler.h:115
speckley::RipleyCoupler::shareBrickXFaces
void shareBrickXFaces(struct Ripley &r, int hasLower, int hasUpper, int lower, int upper, escript::Data &target) const
Definition: CrossDomainCoupler.cpp:552
speckley::lagrange_degree7_6
double lagrange_degree7_6(double xi)
Definition: lagrange_functions.h:158
speckley::lagrange_degree9_5
double lagrange_degree9_5(double xi)
Definition: lagrange_functions.h:222
speckley::lagrange_degree10_2
double lagrange_degree10_2(double xi)
Definition: lagrange_functions.h:250
speckley::lagrange_degree9_9
double lagrange_degree9_9(double xi)
Definition: lagrange_functions.h:238
ripley::Elements
@ Elements
Definition: Ripley.h:71
speckley::lagrange_degree5_2
double lagrange_degree5_2(double xi)
Definition: lagrange_functions.h:90
speckley::SpeckleyDomain::getOrder
int getOrder() const
returns the order of the domain
Definition: speckley/src/SpeckleyDomain.h:756
speckley::lagrange_degree5_0
double lagrange_degree5_0(double xi)
Definition: lagrange_functions.h:82
speckley::lagrange_degree2_2
double lagrange_degree2_2(double xi)
Definition: lagrange_functions.h:42
speckley::lagrange_degree8_8
double lagrange_degree8_8(double xi)
Definition: lagrange_functions.h:198
speckley::lagrange_degree6_4
double lagrange_degree6_4(double xi)
Definition: lagrange_functions.h:122
speckley::RipleyCoupler::calculateOrder2
void calculateOrder2(int dim, double loc, double *results) const
Definition: CrossDomainCoupler.cpp:259
speckley::RipleyCoupler::Ripley
Definition: CrossDomainCoupler.h:65
speckley::lagrange_degree5_3
double lagrange_degree5_3(double xi)
Definition: lagrange_functions.h:94
speckley::lagrange_degree9_0
double lagrange_degree9_0(double xi)
Definition: lagrange_functions.h:202
speckley::lagrange_degree10_8
double lagrange_degree10_8(double xi)
Definition: lagrange_functions.h:274
speckley::lagrange_degree8_7
double lagrange_degree8_7(double xi)
Definition: lagrange_functions.h:194
speckley::lagrange_degree7_2
double lagrange_degree7_2(double xi)
Definition: lagrange_functions.h:142
escript::Data::getDataPointSize
int getDataPointSize() const
Return the size of the data point. It is the product of the data point shape dimensions.
Definition: Data.cpp:1360
speckley::lagrange_degree4_3
double lagrange_degree4_3(double xi)
Definition: lagrange_functions.h:74
speckley::RipleyCoupler::shareWithNeighbours
void shareWithNeighbours(bool lowerFirst, int hasLower, int hasUpper, double *bottom, double *top, double *brecv, double *trecv, int bSize, int tSize, int distance) const
Definition: CrossDomainCoupler.cpp:960
speckley::lagrange_degree9_6
double lagrange_degree9_6(double xi)
Definition: lagrange_functions.h:226
speckley::SpeckleyDomain::getNumSubdivisionsPerDim
virtual const int * getNumSubdivisionsPerDim() const =0
returns the number of spatial subdivisions in each dimension
speckley::lagrange_degree8_6
double lagrange_degree8_6(double xi)
Definition: lagrange_functions.h:190
escript::Data::getFunctionSpace
const FunctionSpace & getFunctionSpace() const
Return the function space.
Definition: Data.h:463
speckley::RipleyCoupler::getEdgeSpacing
void getEdgeSpacing(struct Ripley r, int *lower, int *upper) const
Definition: CrossDomainCoupler.cpp:385
speckley::lagrange_degree7_3
double lagrange_degree7_3(double xi)
Definition: lagrange_functions.h:146
speckley::RipleyCoupler::calculateOrder4
void calculateOrder4(int dim, double loc, double *results) const
Definition: CrossDomainCoupler.cpp:280
speckley::probeInterpolationAcross
bool probeInterpolationAcross(int fsType_source, const escript::AbstractDomain &domain, int fsType_target, int dim)
Definition: CrossDomainCoupler.cpp:32
speckley::RipleyCoupler::calculateOrder8
void calculateOrder8(int dim, double loc, double *results) const
Definition: CrossDomainCoupler.cpp:334
ripley::RipleyDomain::getLength
virtual const double * getLength() const =0
returns the lengths of the domain
speckley::lagrange_degree5_4
double lagrange_degree5_4(double xi)
Definition: lagrange_functions.h:98
speckley
Definition: AbstractAssembler.cpp:19
speckley::RipleyCoupler::shareRectangleXEdges
void shareRectangleXEdges(struct Ripley &r, int hasLower, int hasUpper, int lower, int upper, escript::Data &target) const
Definition: CrossDomainCoupler.cpp:822
speckley::lagrange_degree6_6
double lagrange_degree6_6(double xi)
Definition: lagrange_functions.h:130
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:64
ripley::RipleyDomain
RipleyDomain extends the AbstractContinuousDomain interface for the Ripley library and is the base cl...
Definition: ripley/src/RipleyDomain.h:116
speckley::RipleyCoupler::generateLocations
void generateLocations(struct Ripley &r, double **positions) const
Definition: CrossDomainCoupler.cpp:133
INDEX3
#define INDEX3(_X1_, _X2_, _X3_, _N1_, _N2_)
Definition: index.h:25
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:93
speckley::RipleyCoupler::Ripley::maxs
dim_t maxs[3]
Definition: CrossDomainCoupler.h:70
speckley::lagrange_degree5_1
double lagrange_degree5_1(double xi)
Definition: lagrange_functions.h:86
escript::Data::getSampleDataRW
DataTypes::real_t * getSampleDataRW(DataTypes::RealVectorType::size_type sampleNo, DataTypes::real_t dummy=0)
Return the sample data for the given sample no. Please do not use this unless you NEED to access samp...
Definition: Data.h:1954
speckley::lagrange_degree2_1
double lagrange_degree2_1(double xi)
Definition: lagrange_functions.h:38
speckley::lagrange_degree10_10
double lagrange_degree10_10(double xi)
Definition: lagrange_functions.h:282
speckley::RipleyCoupler::calculateOrder3
void calculateOrder3(int dim, double loc, double *results) const
Definition: CrossDomainCoupler.cpp:269
speckley::lagrange_degree6_2
double lagrange_degree6_2(double xi)
Definition: lagrange_functions.h:114
speckley::lagrange_degree7_0
double lagrange_degree7_0(double xi)
Definition: lagrange_functions.h:134
speckley::Brick
Brick is the 3-dimensional implementation of a SpeckleyDomain.
Definition: speckley/src/Brick.h:47
speckley::lagrange_degree7_7
double lagrange_degree7_7(double xi)
Definition: lagrange_functions.h:162
ripley::RipleyDomain::getNumSubdivisionsPerDim
virtual const int * getNumSubdivisionsPerDim() const =0
returns the number of spatial subdivisions in each dimension
speckley::RipleyCoupler::calculateOrder5
void calculateOrder5(int dim, double loc, double *results) const
Definition: CrossDomainCoupler.cpp:292
speckley::lagrange_degree6_5
double lagrange_degree6_5(double xi)
Definition: lagrange_functions.h:126
speckley::lagrange_degree6_3
double lagrange_degree6_3(double xi)
Definition: lagrange_functions.h:118
speckley::lagrange_degree10_9
double lagrange_degree10_9(double xi)
Definition: lagrange_functions.h:278
speckley::lagrange_degree8_5
double lagrange_degree8_5(double xi)
Definition: lagrange_functions.h:186
speckley::SpeckleyDomain::getNumElementsPerDim
virtual const dim_t * getNumElementsPerDim() const =0
returns the number of elements per MPI rank in each dimension
speckley::lagrange_degree8_4
double lagrange_degree8_4(double xi)
Definition: lagrange_functions.h:182
speckley::SpeckleyDomain
SpeckleyDomain extends the AbstractContinuousDomain interface for the Speckley library and is the bas...
Definition: speckley/src/SpeckleyDomain.h:99
speckley::lagrange_degree7_5
double lagrange_degree7_5(double xi)
Definition: lagrange_functions.h:154
speckley::SpeckleyDomain::getMPIComm
MPI_Comm getMPIComm() const
returns the MPI communicator
Definition: speckley/src/SpeckleyDomain.h:152
speckley::lagrange_degree9_4
double lagrange_degree9_4(double xi)
Definition: lagrange_functions.h:218
speckley::RipleyCoupler::interpolate
void interpolate(escript::Data &target, const escript::Data &source) const
Definition: CrossDomainCoupler.cpp:453
ripley::RipleyDomain::getDim
virtual int getDim() const
returns the number of spatial dimensions of the domain
Definition: ripley/src/RipleyDomain.h:191
speckley::RipleyCoupler::shareRectangleYEdges
void shareRectangleYEdges(struct Ripley &r, int hasLower, int hasUpper, int lower, int upper, escript::Data &target) const
Definition: CrossDomainCoupler.cpp:900
speckley::lagrange_degree5_5
double lagrange_degree5_5(double xi)
Definition: lagrange_functions.h:102
speckley::RipleyCoupler::s_NX
int s_NX[3]
Definition: CrossDomainCoupler.h:113
speckley::lagrange_degree10_6
double lagrange_degree10_6(double xi)
Definition: lagrange_functions.h:266
speckley::lagrange_degree4_0
double lagrange_degree4_0(double xi)
Definition: lagrange_functions.h:62
speckley::lagrange_degree6_0
double lagrange_degree6_0(double xi)
Definition: lagrange_functions.h:106
speckley::Elements
@ Elements
Definition: Speckley.h:80
speckley::lagrange_degree3_0
double lagrange_degree3_0(double xi)
Definition: lagrange_functions.h:46
MPI_DOUBLE
#define MPI_DOUBLE
Definition: EsysMPI.h:47
speckley::lagrange_degree6_1
double lagrange_degree6_1(double xi)
Definition: lagrange_functions.h:110
SHARED
#define SHARED
Definition: CrossDomainCoupler.cpp:24
speckley::lagrange_degree10_0
double lagrange_degree10_0(double xi)
Definition: lagrange_functions.h:242
speckley::lagrange_degree3_2
double lagrange_degree3_2(double xi)
Definition: lagrange_functions.h:54
speckley::RipleyCoupler::numQuads
int numQuads
Definition: CrossDomainCoupler.h:116
speckley::lagrange_degree3_3
double lagrange_degree3_3(double xi)
Definition: lagrange_functions.h:58
ripley::RipleyDomain::getLocalCoordinate
virtual double getLocalCoordinate(index_t index, int dim) const =0
returns the index'th coordinate value in given dimension for this rank
speckley::lagrange_degree2_0
double lagrange_degree2_0(double xi)
Definition: lagrange_functions.h:34
MINE
#define MINE
Definition: CrossDomainCoupler.cpp:23
speckley::RipleyCoupler::validInterpolation
bool validInterpolation(escript::Data &target, const escript::Data &source, const SpeckleyDomain *speck, const double *s_dx, const ripley::RipleyDomain *other) const
Definition: CrossDomainCoupler.cpp:75
speckley::RipleyCoupler::calculate
void calculate(struct Ripley &r, dim_t ex, dim_t ey, dim_t ez, int oqx, int oqy, int oqz, double *out, const double *factor_x, const double *factor_y, const double *factor_z, const escript::Data &source) const
Definition: CrossDomainCoupler.cpp:409
escript::FunctionSpace::getTypeCode
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:95
speckley::SpeckleyDomain::getDim
virtual int getDim() const
returns the number of spatial dimensions of the domain
Definition: speckley/src/SpeckleyDomain.h:171
speckley::lagrange_degree9_7
double lagrange_degree9_7(double xi)
Definition: lagrange_functions.h:230
MPI_Comm
int MPI_Comm
Definition: EsysMPI.h:42
ripley::RipleyDomain::getNumFacesPerBoundary
virtual const dim_t * getNumFacesPerBoundary() const =0
returns the number of face elements in the order (left,right,bottom,top,[front,back]) on current MPI ...
speckley::lagrange_degree7_1
double lagrange_degree7_1(double xi)
Definition: lagrange_functions.h:138
speckley::RipleyCoupler::Ripley::domain
const ripley::RipleyDomain * domain
Definition: CrossDomainCoupler.h:66
speckley::RipleyCoupler::speckley_origin
double speckley_origin[3]
Definition: CrossDomainCoupler.h:114
escript::AbstractDomain
Base class for all escript domains.
Definition: AbstractDomain.h:64
speckley::lagrange_degree3_1
double lagrange_degree3_1(double xi)
Definition: lagrange_functions.h:50
speckley::RipleyCoupler::s_NE
dim_t s_NE[3]
Definition: CrossDomainCoupler.h:111
speckley::RipleyCoupler::Ripley::NE
dim_t NE[3]
Definition: CrossDomainCoupler.h:68
speckley::SpeckleyDomain::getNumFacesPerBoundary
virtual const dim_t * getNumFacesPerBoundary() const =0
returns the number of face elements in the order (left,right,bottom,top,[front,back]) on current MPI ...
speckley::lagrange_degree4_4
double lagrange_degree4_4(double xi)
Definition: lagrange_functions.h:78
ripley::RipleyDomain::getNumElementsPerDim
virtual const dim_t * getNumElementsPerDim() const =0
returns the number of elements per MPI rank in each dimension
speckley::RipleyCoupler::calculateOrder6
void calculateOrder6(int dim, double loc, double *results) const
Definition: CrossDomainCoupler.cpp:305
speckley::SpeckleyException
SpeckleyException exception class.
Definition: SpeckleyException.h:44
speckley::lagrange_degree9_1
double lagrange_degree9_1(double xi)
Definition: lagrange_functions.h:206
THEIRS
#define THEIRS
Definition: CrossDomainCoupler.cpp:25
speckley::lagrange_degree10_5
double lagrange_degree10_5(double xi)
Definition: lagrange_functions.h:262
speckley::RipleyCoupler::numComp
int numComp
Definition: CrossDomainCoupler.h:123
speckley::SpeckleyDomain::getLength
virtual const double * getLength() const =0
returns the lengths of the domain
speckley::RipleyCoupler::shareBrickYFaces
void shareBrickYFaces(struct Ripley &r, int hasLower, int hasUpper, int lower, int upper, escript::Data &target) const
Definition: CrossDomainCoupler.cpp:669