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 
17 
18 /****************************************************************************
19 
20  Some utility routines
21 
22 *****************************************************************************/
23 
24 #ifndef __FINLEY_UTIL_H__
25 #define __FINLEY_UTIL_H__
26 
27 #include "Finley.h"
28 
29 #include <escript/Data.h>
30 
31 namespace finley {
32 namespace util {
33 
34 typedef std::vector< std::pair<int,int> > ValueAndIndexList;
35 
39 void sortValueAndIndex(ValueAndIndexList& array);
40 
43 {
44  const int fs = in.getFunctionSpace().getTypeCode();
48 }
49 
50 void gather(dim_t len, const index_t* index, dim_t numData, const double* in,
51  double* out);
52 
53 void addScatter(dim_t len, const index_t* index, dim_t numData,
54  const double* in, double* out, index_t upperBound);
55 
56 void smallMatMult(int A1, int A2, double* A, int B2,
57  const std::vector<double>& B,
58  const std::vector<double>& C);
59 
60 void smallMatSetMult1(int len, int A1, int A2, double* A, int B2,
61  const std::vector<double>& B,
62  const std::vector<double>& C);
63 
64 void invertSmallMat(int len, int dim, const double* A, double *invA,
65  double* det);
66 
67 void normalVector(int len, int dim, int dim1, const double* A, double* Normal);
68 
69 index_t getMinInt(int dim, dim_t N, const index_t* values);
70 
71 index_t getMaxInt(int dim, dim_t N, const index_t* values);
72 
73 std::pair<index_t,index_t> getMinMaxInt(int dim, dim_t N, const index_t* values);
74 
75 std::pair<index_t,index_t> getFlaggedMinMaxInt(dim_t N, const index_t* values, index_t ignore);
76 
77 std::vector<index_t> packMask(const std::vector<short>& mask);
78 
79 void setValuesInUse(const int *values, const int numValues,
80  std::vector<int>& valuesInUse, esysUtils::JMPI& mpiinfo);
81 
82 } // namespace util
83 } // namespace finley
84 
85 #endif // __FINLEY_UTIL_H__
86 
void gather(dim_t len, const index_t *index, dim_t numData, const double *in, double *out)
Definition: finley/src/Util.cpp:54
std::vector< index_t > packMask(const std::vector< short > &mask)
Definition: finley/src/Util.cpp:339
void setValuesInUse(const int *values, const int numValues, std::vector< int > &valuesInUse, esysUtils::JMPI &mpiinfo)
Definition: finley/src/Util.cpp:350
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:240
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:95
bool hasReducedIntegrationOrder(const escript::Data &in)
returns true if the data object is defined on reduced element types
Definition: finley/src/Util.h:42
std::pair< index_t, index_t > getMinMaxInt(int dim, dim_t N, const index_t *values)
Definition: finley/src/Util.cpp:281
Definition: finley/src/Assemble.h:32
void sortValueAndIndex(ValueAndIndexList &array)
orders a ValueAndIndexList by value
Definition: finley/src/Util.cpp:47
#define FINLEY_REDUCED_CONTACT_ELEMENTS_2
Definition: Finley.h:47
#define FINLEY_REDUCED_FACE_ELEMENTS
Definition: Finley.h:45
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:79
const FunctionSpace & getFunctionSpace() const
Return the function space.
Definition: Data.h:455
Data represents a collection of datapoints.
Definition: Data.h:68
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:261
static dim_t N
Definition: SparseMatrix_saveHB.cpp:37
int getTypeCode() const
Returns the function space type code.
Definition: FunctionSpace.cpp:99
int index_t
Definition: types.h:24
void normalVector(int len, int dim, int dim1, const double *A, double *Normal)
Definition: finley/src/Util.cpp:189
index_t dim_t
Definition: types.h:27
std::pair< index_t, index_t > getFlaggedMinMaxInt(dim_t N, const index_t *values, index_t ignore)
Definition: finley/src/Util.cpp:310
#define FINLEY_REDUCED_CONTACT_ELEMENTS_1
Definition: Finley.h:46
#define FINLEY_REDUCED_ELEMENTS
Definition: Finley.h:44
void addScatter(dim_t len, const index_t *index, dim_t numData, const double *in, double *out, index_t upperBound)
Definition: finley/src/Util.cpp:66
boost::shared_ptr< JMPI_ > JMPI
Definition: Esys_MPI.h:79
void invertSmallMat(int len, int dim, const double *A, double *invA, double *det)
Definition: finley/src/Util.cpp:113
std::vector< std::pair< int, int > > ValueAndIndexList
Definition: finley/src/Util.h:34