/[escript]/trunk/finley/src/Util.h
ViewVC logotype

Contents of /trunk/finley/src/Util.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4492 - (show annotations)
Tue Jul 2 01:44:11 2013 UTC (5 years, 9 months ago) by caltinay
File MIME type: text/plain
File size: 2709 byte(s)
Finley changes that were held back while in release mode - moved more stuff
into finley namespace.

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 #include "esysUtils/Esys_MPI.h"
28
29 #include <escript/Data.h>
30 #include <vector>
31
32 namespace finley {
33 namespace util {
34
35 typedef std::vector< std::pair<int,int> > ValueAndIndexList;
36
37 /// sortValueAndIndex is used to sort items by a value.
38 /// index points to the location of the original item array and can be used
39 /// to reorder the array
40 void sortValueAndIndex(ValueAndIndexList& array);
41
42 /// returns true if the data object is defined on reduced element types
43 inline bool hasReducedIntegrationOrder(const escript::Data& in)
44 {
45 const int fs = in.getFunctionSpace().getTypeCode();
46 return (fs == FINLEY_REDUCED_ELEMENTS || fs == FINLEY_REDUCED_FACE_ELEMENTS
47 || fs == FINLEY_REDUCED_CONTACT_ELEMENTS_1
48 || fs == FINLEY_REDUCED_CONTACT_ELEMENTS_2);
49 }
50
51 void gather(int len, const int* index, int numData, const double* in,
52 double* out);
53
54 void addScatter(int len, const int* index, int numData, const double* in,
55 double* out, int upperBound);
56
57 void smallMatMult(int A1, int A2, double* A, int B2, const double* B,
58 const double* C);
59
60 void smallMatSetMult1(int len, int A1, int A2, double* A, int B2,
61 const double* B, const 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 int packMask(int N, const bool_t* mask, int* index);
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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26