/[escript]/branches/trilinos_from_5897/dudley/src/Util.h
ViewVC logotype

Contents of /branches/trilinos_from_5897/dudley/src/Util.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6079 - (show annotations)
Mon Mar 21 12:22:38 2016 UTC (2 years, 11 months ago) by caltinay
File MIME type: text/plain
File size: 2822 byte(s)
Big commit - making dudley much more like finley to make it more
managable. Fixed quite a few issues that had been fixed in finley.
Disposed of all ReducedNode/ReducedDOF entities that dudley never supported.
Compiles and passes tests.

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 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 /// Some utility routines
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
32 /// orders a ValueAndIndexList by value.
33 void sortValueAndIndex(ValueAndIndexList& array);
34
35 /// gathers values into array `out` from array `in` using `index`:
36 /// out(1:numData, 1:len) := in(1:numData, index(1:len))
37 void gather(int len, const index_t* index, int numData, const double* in,
38 double* out);
39
40 /// adds array `in` into `out` using an `index`:
41 /// out(1:numData,index[p])+=in(1:numData,p) where
42 /// p={k=1...len, index[k]<upperBound}
43 void addScatter(int len, const index_t* index, int numData,
44 const double* in, double *out, index_t upperBound);
45
46 /// multiplies two matrices: A(1:A1,1:A2) := B(1:A1,1:B2)*C(1:B2,1:A2)
47 void smallMatMult(int A1, int A2, double* A, int B2, const double* B,
48 const double* C);
49
50 /// multiplies a set of matrices with a single matrix:
51 /// A(1:A1,1:A2,i)=B(1:A1,1:B2,i)*C(1:B2,1:A2) for i=1,len
52 void smallMatSetMult1(int len, int A1, int A2, double* A, int B2,
53 const double* B, const double* C);
54
55 /// returns the normalized vector normal[dim,len] orthogonal to A(:,0,q) and
56 /// A(:,1,q) in the case of dim=3, or the vector A(:,0,q) in the case of dim=2
57 void normalVector(dim_t len, int dim, int dim1, const double* A, double* normal);
58
59 /// calculates the minimum and maximum value from an integer array of length
60 /// N x dim
61 IndexPair getMinMaxInt(int dim, dim_t N, const index_t* values);
62
63 /// calculates the minimum and maximum value from an integer array of length N
64 /// disregarding the value `ignore`
65 IndexPair getFlaggedMinMaxInt(dim_t N, const index_t* values, index_t ignore);
66
67 /// extracts the positive entries in `mask` returning a contiguous vector of
68 /// those entries
69 std::vector<index_t> packMask(const std::vector<short>& mask);
70
71 void setValuesInUse(const index_t* values, dim_t numValues,
72 std::vector<int>& valuesInUse, escript::JMPI mpiInfo);
73
74 } // namespace util
75 } // namespace dudley
76
77 #endif // __DUDLEY_UTIL_H__
78

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26