dudley/src/Util.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 __DUDLEY_UTIL_H__
#define __DUDLEY_UTIL_H__
#include "Dudley.h"
#include <escript/Data.h>
namespace dudley {
namespace util {
typedef std::pair<index_t,index_t> IndexPair;
typedef std::vector<IndexPair> ValueAndIndexList;
void sortValueAndIndex(ValueAndIndexList& array);
void gather(int len, const index_t* index, int numData, const double* in,
double* out);
template<typename Scalar>
void addScatter(int len, const index_t* index, int numData,
const Scalar* in, Scalar* out, index_t upperBound);
void smallMatMult(int A1, int A2, double* A, int B2, const double* B,
const double* C);
template<typename Scalar>
void smallMatSetMult1(int len, int A1, int A2, Scalar* A, int B2,
const Scalar* B, const double* C);
void normalVector(int len, int dim, int dim1, const double* A, double* normal);
IndexPair getMinMaxInt(int dim, dim_t N, const index_t* values);
IndexPair getFlaggedMinMaxInt(dim_t N, const index_t* values, index_t ignore);
std::vector<index_t> packMask(const std::vector<short>& mask);
void setValuesInUse(const int* values, dim_t numValues,
std::vector<int>& valuesInUse, escript::JMPI mpiInfo);
} // namespace util
} // namespace dudley
#endif // __DUDLEY_UTIL_H__
finley::util::getFlaggedMinMaxInt
IndexPair getFlaggedMinMaxInt(dim_t N, const index_t *values, index_t ignore)
Definition: finley/src/Util.cpp:333
finley::util::addScatter< cplx_t >
template void addScatter< cplx_t >(int len, const index_t *index, int numData, const cplx_t *in, cplx_t *out, index_t upperBound)
paso::N
static dim_t N
Definition: SparseMatrix_saveHB.cpp:52
finley::util::ValueAndIndexList
std::vector< IndexPair > ValueAndIndexList
Definition: finley/src/Util.h:59
dudley::util::smallMatSetMult1
void smallMatSetMult1(int len, int A1, int A2, Scalar *A, int B2, const Scalar *B, const double *C)
Definition: dudley/src/Util.cpp:116
escript::DataTypes::real_t
double real_t
type of all real-valued scalars in escript
Definition: DataTypes.h:79
finley::util::addScatter
void addScatter(int len, const index_t *index, int numData, const Scalar *in, Scalar *out, index_t upperBound)
Definition: finley/src/Util.cpp:83
finley::util::smallMatSetMult1< cplx_t >
template void smallMatSetMult1< cplx_t >(int len, int A1, int A2, cplx_t *A, int B2, const std::vector< cplx_t > &B, const std::vector< real_t > &C)
dudley::DudleyException
Definition: DudleyException.h:39
dudley::util::addScatter< real_t >
template void addScatter< real_t >(int len, const index_t *index, int numData, const real_t *in, real_t *out, index_t upperBound)
escript::DataTypes::index_t_min
index_t index_t_min()
Returns the minimum finite value for the index_t type.
Definition: DataTypes.h:99
finley::util::IndexPair
std::pair< index_t, index_t > IndexPair
Definition: finley/src/Util.h:58
INDEX2
#define INDEX2(_X1_, _X2_, _N1_)
Definition: index.h:23
dudley::util::getMinMaxInt
IndexPair getMinMaxInt(int dim, dim_t N, const index_t *values)
Definition: dudley/src/Util.cpp:187
finley::FinleyException
Definition: FinleyException.h:40
finley::util::smallMatMult
void smallMatMult(int A1, int A2, double *A, int B2, const std::vector< double > &B, const std::vector< double > &C)
multiplies two matrices: A(1:A1,1:A2) := B(1:A1,1:B2)*C(1:B2,1:A2)
Definition: finley/src/Util.cpp:102
dudley::util::smallMatSetMult1< real_t >
template void smallMatSetMult1< real_t >(int len, int A1, int A2, real_t *A, int B2, const real_t *B, const real_t *C)
finley::util::ValueAndIndexCompare
bool ValueAndIndexCompare(const std::pair< int, int > &i, const std::pair< int, int > &j)
comparison function for sortValueAndIndex
Definition: finley/src/Util.cpp:59
Util.h
Dudley.h
MPI_INT
#define MPI_INT
Definition: EsysMPI.h:46
escript::DataTypes::index_t_max
index_t index_t_max()
Returns the maximum finite value for the index_t type.
Definition: DataTypes.h:108
finley::util::setValuesInUse
void setValuesInUse(const int *values, dim_t numValues, std::vector< int > &valuesInUse, escript::JMPI mpiinfo)
Definition: finley/src/Util.cpp:371
dudley
A suite of factory methods for creating 2D and 3D dudley domains.
Definition: dudley/src/Assemble.h:32
dudley::util::getFlaggedMinMaxInt
IndexPair getFlaggedMinMaxInt(dim_t N, const index_t *values, index_t ignore)
Definition: dudley/src/Util.cpp:214
INDEX3
#define INDEX3(_X1_, _X2_, _X3_, _N1_, _N2_)
Definition: index.h:25
finley::util::getMinInt
index_t getMinInt(int dim, dim_t N, const index_t *values)
calculates the minimum value from a dim X N integer array
Definition: finley/src/Util.cpp:265
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:93
finley::util::normalVector
void normalVector(int len, int dim, int dim1, const double *A, double *Normal)
Definition: finley/src/Util.cpp:215
escript::JMPI
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:72
finley::util::sortValueAndIndex
void sortValueAndIndex(ValueAndIndexList &array)
orders a ValueAndIndexList by value.
Definition: finley/src/Util.cpp:67
dudley::util::addScatter< cplx_t >
template void addScatter< cplx_t >(int len, const index_t *index, int numData, const cplx_t *in, cplx_t *out, index_t upperBound)
finley::util::getMinMaxInt
IndexPair getMinMaxInt(int dim, dim_t N, const index_t *values)
Definition: finley/src/Util.cpp:306
finley::util::getMaxInt
index_t getMaxInt(int dim, dim_t N, const index_t *values)
calculates the maximum value from a dim X N integer array
Definition: finley/src/Util.cpp:286
dudley::util::ValueAndIndexList
std::vector< IndexPair > ValueAndIndexList
Definition: dudley/src/Util.h:59
finley::util::gather
void gather(int len, const index_t *index, int numData, const double *in, double *out)
Definition: finley/src/Util.cpp:72
dudley::util::packMask
std::vector< index_t > packMask(const std::vector< short > &mask)
Definition: dudley/src/Util.cpp:241
dudley::util::sortValueAndIndex
void sortValueAndIndex(ValueAndIndexList &array)
orders a ValueAndIndexList by value.
Definition: dudley/src/Util.cpp:67
dudley::util::normalVector
void normalVector(int len, int dim, int dim1, const double *A, double *Normal)
Definition: dudley/src/Util.cpp:138
dudley::util::setValuesInUse
void setValuesInUse(const int *values, dim_t numValues, std::vector< int > &valuesInUse, escript::JMPI mpiinfo)
Definition: dudley/src/Util.cpp:252
MPI_MIN
#define MPI_MIN
Definition: EsysMPI.h:53
finley::util::smallMatSetMult1< real_t >
template void smallMatSetMult1< real_t >(int len, int A1, int A2, real_t *A, int B2, const std::vector< real_t > &B, const std::vector< real_t > &C)
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:88
dudley::util::smallMatMult
void smallMatMult(int A1, int A2, double *A, int B2, const double *B, const double *C)
multiplies two matrices: A(1:A1,1:A2) := B(1:A1,1:B2)*C(1:B2,1:A2)
Definition: dudley/src/Util.cpp:102
finley::util::invertSmallMat
void invertSmallMat(int len, int dim, const double *A, double *invA, double *det)
Definition: finley/src/Util.cpp:144
Util.h
dudley::util::ValueAndIndexCompare
bool ValueAndIndexCompare(const std::pair< int, int > &i, const std::pair< int, int > &j)
comparison function for sortValueAndIndex
Definition: dudley/src/Util.cpp:59
finley::util::smallMatSetMult1
void smallMatSetMult1(int len, int A1, int A2, Scalar *A, int B2, const std::vector< Scalar > &B, const std::vector< real_t > &C)
Definition: finley/src/Util.cpp:117
dudley::util::gather
void gather(int len, const index_t *index, int numData, const double *in, double *out)
Definition: dudley/src/Util.cpp:72
finley::util::addScatter< real_t >
template void addScatter< real_t >(int len, const index_t *index, int numData, const real_t *in, real_t *out, index_t upperBound)
escript::DataTypes::cplx_t
std::complex< real_t > cplx_t
complex data type
Definition: DataTypes.h:82
escript::Scalar
Data Scalar(double value, const FunctionSpace &what, bool expanded)
A collection of factory functions for creating Data objects which contain data points of various shap...
Definition: DataFactory.cpp:63
finley
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:32
finley::util::packMask
std::vector< index_t > packMask(const std::vector< short > &mask)
Definition: finley/src/Util.cpp:360
escript::ValueError
An exception class that signals an invalid argument value.
Definition: EsysException.h:103
dudley::util::smallMatSetMult1< cplx_t >
template void smallMatSetMult1< cplx_t >(int len, int A1, int A2, cplx_t *A, int B2, const cplx_t *B, const real_t *C)
dudley::util::IndexPair
std::pair< index_t, index_t > IndexPair
Definition: dudley/src/Util.h:58
dudley::util::addScatter
void addScatter(int len, const index_t *index, int numData, const Scalar *in, Scalar *out, index_t upperBound)
Definition: dudley/src/Util.cpp:83