ESScript  Revision_4488
DataFactory.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 #if !defined escript_DataFactory_20040721_H
18 #define escript_DataFactory_20040721_H
19 
20 #ifdef BADPYTHONMACROS
21 // This hack is required for BSD/OSX builds with python 2.7
22 // (and possibly others). It must be the first include.
23 // From bug reports online it seems that python redefines
24 // some c macros that are functions in c++.
25 // c++ doesn't like that!
26 #include <Python.h>
27 #undef BADPYTHONMACROS
28 #endif
29 
30 
31 #include "system_dep.h"
32 
33 #include "AbstractDomain.h"
34 #include "FunctionSpace.h"
35 #include "Data.h"
36 
37 #include <boost/python/object.hpp>
38 
39 namespace escript {
40 
57 ESCRIPT_DLL_API Data
58 Scalar(double value,
59  const FunctionSpace& what=FunctionSpace(),
60  bool expanded=false);
61 
67 ESCRIPT_DLL_API Data
68 Vector(double value,
69  const FunctionSpace& what=FunctionSpace(),
70  bool expanded=false);
71 
73 Data
74 VectorFromObj(boost::python::object o,
75  const FunctionSpace& what=FunctionSpace(),
76  bool expanded=false);
77 
83 ESCRIPT_DLL_API Data
84 Tensor(double value,
85  const FunctionSpace& what=FunctionSpace(),
86  bool expanded=false);
87 
89 Data
90 TensorFromObj(boost::python::object o,
91  const FunctionSpace& what=FunctionSpace(),
92  bool expanded=false);
98 ESCRIPT_DLL_API Data
99 Tensor3(double value,
100  const FunctionSpace& what=FunctionSpace(),
101  bool expanded=false);
102 
104 Data
105 Tensor3FromObj(boost::python::object o,
106  const FunctionSpace& what=FunctionSpace(),
107  bool expanded=false);
108 
114 ESCRIPT_DLL_API Data
115 Tensor4(double value,
116  const FunctionSpace& what=FunctionSpace(),
117  bool expanded=false);
118 
120 Data
121 Tensor4FromObj(boost::python::object o,
122  const FunctionSpace& what=FunctionSpace(),
123  bool expanded=false);
124 
129 ESCRIPT_DLL_API Data
130 load(const std::string fileName,
131  const AbstractDomain& domain);
136 ESCRIPT_DLL_API bool
138 
146 ESCRIPT_DLL_API Data
147 convertToData(const boost::python::object& value,
148  const FunctionSpace& what=FunctionSpace());
149 
150 
151 } // end of namespace
152 
153 #endif