finley/src/Util.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 __FINLEY_UTIL_H__
#define __FINLEY_UTIL_H__
#include "Finley.h"
#include <escript/Data.h>
namespace finley {
namespace util {
typedef std::pair<index_t,index_t> IndexPair;
typedef std::vector<IndexPair> ValueAndIndexList;
void sortValueAndIndex(ValueAndIndexList& array);
inline bool hasReducedIntegrationOrder(const escript::Data& in)
{
const int fs = in.getFunctionSpace().getTypeCode();
return (fs == FINLEY_REDUCED_ELEMENTS || fs == FINLEY_REDUCED_FACE_ELEMENTS
|| fs == FINLEY_REDUCED_CONTACT_ELEMENTS_1
|| fs == FINLEY_REDUCED_CONTACT_ELEMENTS_2);
}
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 std::vector<double>& B,
const std::vector<double>& C);
template<typename Scalar>
void smallMatSetMult1(int len, int A1, int A2, Scalar* A, int B2,
const std::vector<Scalar>& B,
const std::vector<double>& C);
void invertSmallMat(int len, int dim, const double* A, double *invA,
double* det);
void normalVector(int len, int dim, int dim1, const double* A, double* Normal);
index_t getMinInt(int dim, dim_t N, const index_t* values);
index_t getMaxInt(int dim, dim_t N, const index_t* values);
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 finley
#endif // __FINLEY_UTIL_H__
finley::util::getFlaggedMinMaxInt
IndexPair getFlaggedMinMaxInt(dim_t N, const index_t *values, index_t ignore)
Definition: finley/src/Util.cpp:304
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:54
finley::util::packMask
std::vector< index_t > packMask(const std::vector< short > &mask)
Definition: finley/src/Util.cpp:331
finley::util::IndexPair
std::pair< index_t, index_t > IndexPair
Definition: finley/src/Util.h:29
escript::JMPI
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:71
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:236
finley::util::setValuesInUse
void setValuesInUse(const int *values, dim_t numValues, std::vector< int > &valuesInUse, escript::JMPI mpiinfo)
Definition: finley/src/Util.cpp:342
finley::util::hasReducedIntegrationOrder
bool hasReducedIntegrationOrder(const escript::Data &in)
returns true if the data object is defined on reduced element types
Definition: finley/src/Util.h:36
finley
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:31
finley::util::sortValueAndIndex
void sortValueAndIndex(ValueAndIndexList &array)
orders a ValueAndIndexList by value.
Definition: finley/src/Util.cpp:38
FINLEY_REDUCED_CONTACT_ELEMENTS_2
#define FINLEY_REDUCED_CONTACT_ELEMENTS_2
Definition: Finley.h:58
FINLEY_REDUCED_FACE_ELEMENTS
#define FINLEY_REDUCED_FACE_ELEMENTS
Definition: Finley.h:56
escript::DataTypes::index_t
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:59
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:73
escript::Data::getFunctionSpace
const FunctionSpace & getFunctionSpace() const
Return the function space.
Definition: Data.h:452
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:88
finley::util::getMinMaxInt
IndexPair getMinMaxInt(int dim, dim_t N, const index_t *values)
Definition: finley/src/Util.cpp:277
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:63
escript::FunctionSpace::getTypeCode
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:94
finley::util::gather
void gather(int len, const index_t *index, int numData, const double *in, double *out)
Definition: finley/src/Util.cpp:43
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:257
paso::N
static dim_t N
Definition: SparseMatrix_saveHB.cpp:37
finley::util::ValueAndIndexList
std::vector< IndexPair > ValueAndIndexList
Definition: finley/src/Util.h:30
finley::util::normalVector
void normalVector(int len, int dim, int dim1, const double *A, double *Normal)
Definition: finley/src/Util.cpp:186
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:48
FINLEY_REDUCED_CONTACT_ELEMENTS_1
#define FINLEY_REDUCED_CONTACT_ELEMENTS_1
Definition: Finley.h:57
Finley.h
FINLEY_REDUCED_ELEMENTS
#define FINLEY_REDUCED_ELEMENTS
Definition: Finley.h:55
finley::util::invertSmallMat
void invertSmallMat(int len, int dim, const double *A, double *invA, double *det)
Definition: finley/src/Util.cpp:115
escript::DataTypes::dim_t
index_t dim_t
Definition: DataTypes.h:64