escript  Revision_
finley/src/Util.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16 
18 
19 #ifndef __FINLEY_UTIL_H__
20 #define __FINLEY_UTIL_H__
21 
22 #include "Finley.h"
23 
24 #include <escript/Data.h>
25 
26 namespace finley {
27 namespace util {
28 
29 typedef std::pair<index_t,index_t> IndexPair;
30 typedef std::vector<IndexPair> ValueAndIndexList;
31 
33 void sortValueAndIndex(ValueAndIndexList& array);
34 
37 {
38  const int fs = in.getFunctionSpace().getTypeCode();
42 }
43 
46 void gather(int len, const index_t* index, int numData, const double* in,
47  double* out);
48 
52 template<typename Scalar>
53 void addScatter(int len, const index_t* index, int numData,
54  const Scalar* in, Scalar* out, index_t upperBound);
55 
57 void smallMatMult(int A1, int A2, double* A, int B2,
58  const std::vector<double>& B,
59  const std::vector<double>& C);
60 
63 void smallMatSetMult1(int len, int A1, int A2, double* A, int B2,
64  const std::vector<double>& B,
65  const std::vector<double>& C);
66 
67 void invertSmallMat(int len, int dim, const double* A, double *invA,
68  double* det);
69 
72 void normalVector(int len, int dim, int dim1, const double* A, double* Normal);
73 
74 index_t getMinInt(int dim, dim_t N, const index_t* values);
75 
76 index_t getMaxInt(int dim, dim_t N, const index_t* values);
77 
80 IndexPair getMinMaxInt(int dim, dim_t N, const index_t* values);
81 
84 IndexPair getFlaggedMinMaxInt(dim_t N, const index_t* values, index_t ignore);
85 
88 std::vector<index_t> packMask(const std::vector<short>& mask);
89 
90 void setValuesInUse(const int* values, dim_t numValues,
91  std::vector<int>& valuesInUse, escript::JMPI mpiInfo);
92 
93 } // namespace util
94 } // namespace finley
95 
96 #endif // __FINLEY_UTIL_H__
97 
IndexPair getFlaggedMinMaxInt(dim_t N, const index_t *values, index_t ignore)
Definition: finley/src/Util.cpp:294
void addScatter(int len, const index_t *index, int numData, const Scalar *in, Scalar *out, index_t upperBound)
Definition: finley/src/Util.cpp:54
std::vector< index_t > packMask(const std::vector< short > &mask)
Definition: finley/src/Util.cpp:321
std::pair< index_t, index_t > IndexPair
Definition: finley/src/Util.h:29
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:71
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:226
void setValuesInUse(const int *values, dim_t numValues, std::vector< int > &valuesInUse, escript::JMPI mpiinfo)
Definition: finley/src/Util.cpp:332
void smallMatSetMult1(int len, int A1, int A2, double *A, int B2, const std::vector< double > &B, const std::vector< double > &C)
Definition: finley/src/Util.cpp:87
bool hasReducedIntegrationOrder(const escript::Data &in)
returns true if the data object is defined on reduced element types
Definition: finley/src/Util.h:36
A suite of factory methods for creating various finley domains.
Definition: finley/src/Assemble.h:31
void sortValueAndIndex(ValueAndIndexList &array)
orders a ValueAndIndexList by value.
Definition: finley/src/Util.cpp:38
#define FINLEY_REDUCED_CONTACT_ELEMENTS_2
Definition: Finley.h:58
#define FINLEY_REDUCED_FACE_ELEMENTS
Definition: Finley.h:56
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:59
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
const FunctionSpace & getFunctionSpace() const
Return the function space.
Definition: Data.h:452
IndexPair getMinMaxInt(int dim, dim_t N, const index_t *values)
Definition: finley/src/Util.cpp:267
Data represents a collection of datapoints.
Definition: Data.h:63
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:94
void gather(int len, const index_t *index, int numData, const double *in, double *out)
Definition: finley/src/Util.cpp:43
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:247
static dim_t N
Definition: SparseMatrix_saveHB.cpp:37
std::vector< IndexPair > ValueAndIndexList
Definition: finley/src/Util.h:30
void normalVector(int len, int dim, int dim1, const double *A, double *Normal)
Definition: finley/src/Util.cpp:176
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:32
#define FINLEY_REDUCED_CONTACT_ELEMENTS_1
Definition: Finley.h:57
#define FINLEY_REDUCED_ELEMENTS
Definition: Finley.h:55
void invertSmallMat(int len, int dim, const double *A, double *invA, double *det)
Definition: finley/src/Util.cpp:105
index_t dim_t
Definition: DataTypes.h:64