ESScript  Revision_
finley/src/Util.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 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 since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15 
16 
17 /****************************************************************************
18 
19  Some utility routines
20 
21 *****************************************************************************/
22 
23 #ifndef __FINLEY_UTIL_H__
24 #define __FINLEY_UTIL_H__
25 
26 #include "Finley.h"
27 
28 #include <escript/Data.h>
29 
30 namespace finley {
31 namespace util {
32 
33 typedef std::vector< std::pair<int,int> > ValueAndIndexList;
34 
39 
41 inline bool hasReducedIntegrationOrder(const escript::Data& in)
42 {
43  const int fs = in.getFunctionSpace().getTypeCode();
47 }
48 
49 void gather(int len, const int* index, int numData, const double* in,
50  double* out);
51 
52 void addScatter(int len, const int* index, int numData, const double* in,
53  double* out, int upperBound);
54 
55 void smallMatMult(int A1, int A2, double* A, int B2,
56  const std::vector<double>& B,
57  const std::vector<double>& C);
58 
59 void smallMatSetMult1(int len, int A1, int A2, double* A, int B2,
60  const std::vector<double>& B,
61  const std::vector<double>& C);
62 
63 void invertSmallMat(int len, int dim, const double* A, double *invA,
64  double* det);
65 
66 void normalVector(int len, int dim, int dim1, const double* A, double* Normal);
67 
68 int getMinInt(int dim, int N, const int* values);
69 
70 int getMaxInt(int dim, int N, const int* values);
71 
72 std::pair<int,int> getMinMaxInt(int dim, int N, const int* values);
73 
74 std::pair<int,int> getFlaggedMinMaxInt(int N, const int* values, int ignore);
75 
76 std::vector<int> packMask(const std::vector<short>& mask);
77 
78 void setValuesInUse(const int *values, const int numValues,
79  std::vector<int>& valuesInUse, Esys_MPIInfo* mpiinfo);
80 
81 } // namespace util
82 } // namespace finley
83 
84 #endif // __FINLEY_UTIL_H__
85