escript  Revision_
dudley/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 __DUDLEY_UTIL_H__
20 #define __DUDLEY_UTIL_H__
21 
22 #include "Dudley.h"
23 
24 #include <escript/Data.h>
25 
26 namespace dudley {
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 void gather(int len, const index_t* index, int numData, const double* in,
38  double* out);
39 
43 template<typename Scalar>
44 void addScatter(int len, const index_t* index, int numData,
45  const Scalar* in, Scalar* out, index_t upperBound);
46 
48 void smallMatMult(int A1, int A2, double* A, int B2, const double* B,
49  const double* C);
50 
53 void smallMatSetMult1(int len, int A1, int A2, double* A, int B2,
54  const double* B, const double* C);
55 
58 void normalVector(int len, int dim, int dim1, const double* A, double* normal);
59 
62 IndexPair getMinMaxInt(int dim, dim_t N, const index_t* values);
63 
66 IndexPair getFlaggedMinMaxInt(dim_t N, const index_t* values, index_t ignore);
67 
70 std::vector<index_t> packMask(const std::vector<short>& mask);
71 
72 void setValuesInUse(const int* values, dim_t numValues,
73  std::vector<int>& valuesInUse, escript::JMPI mpiInfo);
74 
75 } // namespace util
76 } // namespace dudley
77 
78 #endif // __DUDLEY_UTIL_H__
79 
std::vector< IndexPair > ValueAndIndexList
Definition: dudley/src/Util.h:30
IndexPair getMinMaxInt(int dim, dim_t N, const index_t *values)
Definition: dudley/src/Util.cpp:150
void smallMatMult(int A1, int A2, double *A, int B2, const double *B, const double *C)
multiplies two matrices: A(1:A1,1:A2) := B(1:A1,1:B2)*C(1:B2,1:A2)
Definition: dudley/src/Util.cpp:73
boost::shared_ptr< JMPI_ > JMPI
Definition: EsysMPI.h:71
void addScatter(int len, const index_t *index, int numData, const Scalar *in, Scalar *out, index_t upperBound)
Definition: dudley/src/Util.cpp:54
std::vector< index_t > packMask(const std::vector< short > &mask)
Definition: dudley/src/Util.cpp:204
void normalVector(int len, int dim, int dim1, const double *A, double *Normal)
Definition: dudley/src/Util.cpp:101
void sortValueAndIndex(ValueAndIndexList &array)
orders a ValueAndIndexList by value.
Definition: dudley/src/Util.cpp:38
void setValuesInUse(const int *values, dim_t numValues, std::vector< int > &valuesInUse, escript::JMPI mpiinfo)
Definition: dudley/src/Util.cpp:215
int index_t
type for array/matrix indices used both globally and on each rank
Definition: DataTypes.h:59
void smallMatSetMult1(int len, int A1, int A2, double *A, int B2, const double *B, const double *C)
Definition: dudley/src/Util.cpp:86
std::pair< index_t, index_t > IndexPair
Definition: dudley/src/Util.h:29
A suite of factory methods for creating 2D and 3D dudley domains.
Definition: dudley/src/Assemble.h:31
static dim_t N
Definition: SparseMatrix_saveHB.cpp:37
void gather(int len, const index_t *index, int numData, const double *in, double *out)
Definition: dudley/src/Util.cpp:43
IndexPair getFlaggedMinMaxInt(dim_t N, const index_t *values, index_t ignore)
Definition: dudley/src/Util.cpp:177
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
index_t dim_t
Definition: DataTypes.h:64