/[escript]/trunk/escriptcore/src/ES_optype.cpp
ViewVC logotype

Contents of /trunk/escriptcore/src/ES_optype.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6536 - (show annotations)
Mon Mar 13 06:30:35 2017 UTC (2 years, 1 month ago) by jfenwick
File size: 3738 byte(s)
Bug fixes.

Correcting earlier correction.
Debug output now includes group information in some cases.
Fixed tree format output.
Fixed bug where G_UNARY_R with complex child was being resolved
as real.


1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2017 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
17
18 #include "ES_optype.h"
19 #include <string>
20
21 using namespace escript;
22
23 namespace
24 {
25
26 std::string ES_opstrings[]={"UNKNOWN","IDENTITY","+","-","*","/","^",
27 "sin","cos","tan",
28 "asin","acos","atan","sinh","cosh","tanh","erf",
29 "asinh","acosh","atanh",
30 "log10","log","sign","abs","neg","pos","exp","sqrt",
31 "1/","where>0","where<0","where>=0","where<=0", "where<>0","where=0",
32 "symmetric","antisymmetric",
33 "prod",
34 "transpose", "trace",
35 "swapaxes",
36 "minval", "maxval",
37 "condEval",
38 "hermitian","antihermitian",
39 "real","imaginary","conjugate",
40 "<", ">", ">=", "<=",
41 "phase",
42 "promote"
43 };
44
45
46 ES_opgroup opgroups[]={G_UNKNOWN,G_IDENTITY,G_BINARY,G_BINARY,G_BINARY,G_BINARY, G_BINARY,
47 G_UNARY,G_UNARY,G_UNARY, //10
48 G_UNARY,G_UNARY,G_UNARY,G_UNARY,G_UNARY,G_UNARY,G_UNARY, // 17
49 G_UNARY,G_UNARY,G_UNARY, // 20
50 G_UNARY,G_UNARY,G_UNARY,G_UNARY_R,G_UNARY,G_UNARY,G_UNARY,G_UNARY, // 28
51 G_UNARY,G_UNARY,G_UNARY,G_UNARY,G_UNARY, G_UNARY_P, G_UNARY_P, // 35
52 G_NP1OUT,G_NP1OUT,
53 G_TENSORPROD,
54 G_NP1OUT_P, G_NP1OUT_P,
55 G_NP1OUT_2P,
56 G_REDUCTION, G_REDUCTION,
57 G_CONDEVAL,
58 G_NP1OUT,G_NP1OUT,
59 G_UNARY_R, G_UNARY_R, G_UNARY,
60 G_UNARY_R, G_UNARY_R, G_UNARY_R, G_UNARY_R,
61 G_UNARY_R,
62 G_UNARY_C
63 };
64
65 std::string ES_groupstrings[]={
66 "G_UNKNOWN",
67 "G_IDENTITY",
68 "G_BINARY", // pointwise operations with two arguments
69 "G_UNARY", // pointwise operations with one argument
70 "G_UNARY_P", // pointwise operations with one argument, requiring a parameter
71 "G_UNARY_R", // pointwise operations with one argument, always real output
72 "G_NP1OUT", // non-pointwise op with one output
73 "G_NP1OUT_P", // non-pointwise op with one output requiring a parameter
74 "G_TENSORPROD", // general tensor product
75 "G_NP1OUT_2P", // non-pointwise op with one output requiring two params
76 "G_REDUCTION", // non-pointwise unary op with a scalar output
77 "G_CONDEVAL",
78 "G_UNARY_C" // pointwise operations with one argument, always cplx output
79 };
80
81 int ES_opcount=55;
82 int ES_groupcount=13;
83 }
84
85 // Return a string representing the operation
86 const std::string&
87 escript::opToString(ES_optype op)
88 {
89 if (op<0 || op>=ES_opcount)
90 {
91 op=UNKNOWNOP;
92 }
93 return ES_opstrings[op];
94 }
95
96 ES_opgroup
97 escript::getOpgroup(ES_optype op)
98 {
99 return opgroups[op];
100 }
101
102 const std::string&
103 escript::groupToString(ES_opgroup g)
104 {
105 if (g<0 || g>=ES_groupcount)
106 {
107 g=G_UNKNOWN;
108 }
109 return ES_groupstrings[g];
110 }

  ViewVC Help
Powered by ViewVC 1.1.26