ESScript
Revision_4488
Main Page
Namespaces
Classes
Files
File List
File Members
finley
src
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
#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
40
void
sortValueAndIndex
(
ValueAndIndexList
& array);
41
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
int
getFlaggedMinInt
(
int
dim,
int
N
,
const
int
* values,
int
ignore);
75
76
int
getFlaggedMaxInt
(
int
dim,
int
N
,
const
int
* values,
int
ignore);
77
78
int
packMask
(
int
N
,
const
bool_t
* mask,
int
* index);
79
80
void
setValuesInUse
(
const
int
*values,
const
int
numValues,
81
std::vector<int>& valuesInUse,
Esys_MPIInfo
* mpiinfo);
82
83
}
// namespace util
84
}
// namespace finley
85
86
#endif // __FINLEY_UTIL_H__
87
Generated on Fri Jun 28 2013 11:10:53 for ESScript by
1.8.1.2