escript  Revision_
Utils.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2020 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-2017 by Centre for Geoscience Computing (GeoComp)
14 * Development from 2019 by School of Earth and Environmental Sciences
15 **
16 *****************************************************************************/
17 
18 #ifndef __ESCRIPT_UTILS_H__
19 #define __ESCRIPT_UTILS_H__
20 
21 #include "system_dep.h"
22 #include <boost/python/dict.hpp>
23 
24 #ifdef ESYS_HAVE_BOOST_NUMPY
25 #include <boost/python/numpy.hpp>
26 #endif
27 
28 namespace escript {
29 
41 
47 
53 ESCRIPT_DLL_API void setNumberOfThreads(const int num_threads);
54 
60 
66 
72 
77 ESCRIPT_DLL_API int getMPIWorldMax(const int val);
78 
82 ESCRIPT_DLL_API int getMPIWorldSum(const int val);
83 
88 
92 ESCRIPT_DLL_API int runMPIProgram(const boost::python::list args);
93 
99 
100 /*
101  \brief
102  return largest positive float
103 */
105 
106 ESCRIPT_DLL_API void saveDataCSV(const std::string& filename,
107  boost::python::dict arg,
108  const std::string& sep,
109  const std::string& csep,
110  bool refid=false,
111  bool append=false);
112 
113 #ifdef ESYS_HAVE_BOOST_NUMPY
114 ESCRIPT_DLL_API boost::python::list getNumpy(boost::python::dict arg);
115 #else
116 ESCRIPT_DLL_API void getNumpy(boost::python::dict arg);
117 #endif
118 
119 #ifdef ESYS_HAVE_BOOST_NUMPY
120 ESCRIPT_DLL_API boost::python::numpy::ndarray convertToNumpy(escript::Data data);
121 #else
123 #endif
124 
125 // #ifdef ESYS_HAVE_BOOST_NUMPY
126 // void initBoostNumpy();
127 // #endif
128 
129 #ifdef ESYS_HAVE_BOOST_NUMPY
130 escript::Data numpyToData(boost::python::numpy::ndarray& array, bool isComplex, FunctionSpace& functionspace);
131 #endif
132 
133 
141 ESCRIPT_DLL_API void resolveGroup(boost::python::object obj);
142 
143 } // end of namespace
144 
145 #endif // __ESCRIPT_UTILS_H__
Data represents a collection of datapoints.
Definition: Data.h:64
Definition: FunctionSpace.h:36
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
Definition: AbstractContinuousDomain.cpp:23
int getMPIWorldMax(int val)
returns the maximum value of an integer over all processors within MPI_COMM_WORLD
Definition: Utils.cpp:114
void saveDataCSV(const std::string &filename, bp::dict arg, const std::string &sep, const std::string &csep, bool refid, bool append)
Definition: Utils.cpp:390
int getNumberOfThreads()
returns the number of threads
Definition: Utils.cpp:87
void MPIBarrierWorld()
performs a barrier synchronization across all processors.
Definition: Utils.cpp:379
int runMPIProgram(bp::list args)
Definition: Utils.cpp:314
int getMPIWorldSum(int val)
returns sum of an integer over all processors with MPI_COMM_WORLD
Definition: Utils.cpp:126
int getMPISizeWorld()
returns the total number of available MPI processes for MPI_COMM_WORLD
Definition: Utils.cpp:96
void resolveGroup(bp::object obj)
Definition: Utils.cpp:996
void getNumpy(bp::dict arg)
Definition: Utils.cpp:930
double getMaxFloat()
Definition: Utils.cpp:374
int getSvnVersion()
some functions
Definition: Utils.cpp:45
void convertToNumpy(escript::Data data)
Definition: Utils.cpp:991
void printParallelThreadCnt()
print a message about how many MPI CPUs and OpenMP threads we're using
Definition: Utils.cpp:138
void setNumberOfThreads(int num_threads)
set the number of threads
Definition: Utils.cpp:80
int getMPIRankWorld()
returns the MPI processor number within MPI_COMM_WORLD
Definition: Utils.cpp:105
double getMachinePrecision()
returns the machine precision
Definition: Utils.cpp:369