escript  Revision_4925
finley/src/Util.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
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 
40 
43 {
44  const int fs = in.getFunctionSpace().getTypeCode();
48 }
49 
50 void gather(int len, const int* index, int numData, const double* in,
51  double* out);
52 
53 void addScatter(int len, const int* index, int numData, const double* in,
54  double* out, int 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 int getMinInt(int dim, int N, const int* values);
70 
71 int getMaxInt(int dim, int N, const int* values);
72 
73 std::pair<int,int> getMinMaxInt(int dim, int N, const int* values);
74 
75 std::pair<int,int> getFlaggedMinMaxInt(int N, const int* values, int ignore);
76 
77 std::vector<int> packMask(const std::vector<short>& mask);
78 
79 void setValuesInUse(const int *values, const int numValues,
80  std::vector<int>& valuesInUse, Esys_MPIInfo* mpiinfo);
81 
82 } // namespace util
83 } // namespace finley
84 
85 #endif // __FINLEY_UTIL_H__
86 
void addScatter(const int len, const int *index, const int numData, const double *in, double *out, const int upperBound)
Definition: finley/src/Util.cpp:63
Struct that holds MPI communicator, rank, size and a tag counter.
Definition: Esys_MPI.h:48
std::pair< int, int > getMinMaxInt(int dim, int N, const int *values)
Definition: finley/src/Util.cpp:277
int getMaxInt(int dim, int N, const int *values)
calculates the maximum value from a dim X N integer array
Definition: finley/src/Util.cpp:257
void setValuesInUse(const int *values, const int numValues, std::vector< int > &valuesInUse, Esys_MPIInfo *mpiinfo)
Definition: finley/src/Util.cpp:346
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:91
bool hasReducedIntegrationOrder(const escript::Data &in)
returns true if the data object is defined on reduced element types
Definition: finley/src/Util.h:42
void sortValueAndIndex(ValueAndIndexList &array)
orders a ValueAndIndexList by value
Definition: finley/src/Util.cpp:44
#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:75
void gather(int len, const int *index, int numData, const double *in, double *out)
Definition: finley/src/Util.cpp:51
const FunctionSpace & getFunctionSpace() const
Return the function space.
Definition: Data.h:461
Data represents a collection of datapoints.
Definition: Data.h:71
int getMinInt(int dim, int N, const int *values)
calculates the minimum value from a dim X N integer array
Definition: finley/src/Util.cpp:236
static dim_t N
Definition: SparseMatrix_saveHB.cpp:36
std::pair< int, int > getFlaggedMinMaxInt(int N, const int *values, int ignore)
Definition: finley/src/Util.cpp:306
int getTypeCode() const
Return the function space type code.
Definition: FunctionSpace.cpp:95
void normalVector(int len, int dim, int dim1, const double *A, double *Normal)
Definition: finley/src/Util.cpp:185
std::vector< int > packMask(const std::vector< short > &mask)
Definition: finley/src/Util.cpp:335
#define FINLEY_REDUCED_CONTACT_ELEMENTS_1
Definition: Finley.h:46
#define FINLEY_REDUCED_ELEMENTS
Definition: Finley.h:44
void invertSmallMat(int len, int dim, const double *A, double *invA, double *det)
Definition: finley/src/Util.cpp:109
std::vector< std::pair< int, int > > ValueAndIndexList
Definition: finley/src/Util.h:34