Utils.h
Go to the documentation of this file.
/*****************************************************************************
*
* Copyright (c) 2003-2020 by The University of Queensland
* http://www.uq.edu.au
*
* Primary Business: Queensland, Australia
* Licensed under the Apache License, version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Development until 2012 by Earth Systems Science Computational Center (ESSCC)
* Development 2012-2013 by School of Earth Sciences
* Development from 2014-2017 by Centre for Geoscience Computing (GeoComp)
* Development from 2019 by School of Earth and Environmental Sciences
**
*****************************************************************************/
#ifndef __ESCRIPT_UTILS_H__
#define __ESCRIPT_UTILS_H__
#include "system_dep.h"
#include <boost/python/dict.hpp>
#ifdef ESYS_HAVE_BOOST_NUMPY
#include <boost/python/numpy.hpp>
#endif
namespace escript {
ESCRIPT_DLL_API int getSvnVersion();
ESCRIPT_DLL_API void printParallelThreadCnt();
ESCRIPT_DLL_API void setNumberOfThreads(const int num_threads);
ESCRIPT_DLL_API int getNumberOfThreads();
ESCRIPT_DLL_API int getMPISizeWorld();
ESCRIPT_DLL_API int getMPIRankWorld();
ESCRIPT_DLL_API int getMPIWorldMax(const int val);
ESCRIPT_DLL_API int getMPIWorldSum(const int val);
ESCRIPT_DLL_API void MPIBarrierWorld();
ESCRIPT_DLL_API int runMPIProgram(const boost::python::list args);
ESCRIPT_DLL_API double getMachinePrecision();
/*
\brief
return largest positive float
*/
ESCRIPT_DLL_API double getMaxFloat();
ESCRIPT_DLL_API void saveDataCSV(const std::string& filename,
boost::python::dict arg,
const std::string& sep,
const std::string& csep,
bool refid=false,
bool append=false);
#ifdef ESYS_HAVE_BOOST_NUMPY
ESCRIPT_DLL_API boost::python::list getNumpy(boost::python::dict arg);
#else
ESCRIPT_DLL_API void getNumpy(boost::python::dict arg);
#endif
#ifdef ESYS_HAVE_BOOST_NUMPY
ESCRIPT_DLL_API boost::python::numpy::ndarray convertToNumpy(escript::Data data);
#else
ESCRIPT_DLL_API void convertToNumpy(escript::Data data);
#endif
// #ifdef ESYS_HAVE_BOOST_NUMPY
// void initBoostNumpy();
// #endif
#ifdef ESYS_HAVE_BOOST_NUMPY
escript::Data numpyToData(boost::python::numpy::ndarray& array, bool isComplex, FunctionSpace& functionspace);
#endif
ESCRIPT_DLL_API void resolveGroup(boost::python::object obj);
} // end of namespace
#endif // __ESCRIPT_UTILS_H__
escript::Data
Data represents a collection of datapoints.
Definition: Data.h:64
escript::FunctionSpace
Definition: FunctionSpace.h:36
ESCRIPT_DLL_API
#define ESCRIPT_DLL_API
Definition: escriptcore/src/system_dep.h:30
escript
Definition: AbstractContinuousDomain.cpp:23
escript::getMPIWorldMax
int getMPIWorldMax(int val)
returns the maximum value of an integer over all processors within MPI_COMM_WORLD
Definition: Utils.cpp:114
escript::saveDataCSV
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
escript::getNumberOfThreads
int getNumberOfThreads()
returns the number of threads
Definition: Utils.cpp:87
escript::MPIBarrierWorld
void MPIBarrierWorld()
performs a barrier synchronization across all processors.
Definition: Utils.cpp:379
escript::runMPIProgram
int runMPIProgram(bp::list args)
Definition: Utils.cpp:314
escript::getMPIWorldSum
int getMPIWorldSum(int val)
returns sum of an integer over all processors with MPI_COMM_WORLD
Definition: Utils.cpp:126
escript::getMPISizeWorld
int getMPISizeWorld()
returns the total number of available MPI processes for MPI_COMM_WORLD
Definition: Utils.cpp:96
escript::resolveGroup
void resolveGroup(bp::object obj)
Definition: Utils.cpp:996
escript::getNumpy
void getNumpy(bp::dict arg)
Definition: Utils.cpp:930
escript::getMaxFloat
double getMaxFloat()
Definition: Utils.cpp:374
escript::getSvnVersion
int getSvnVersion()
some functions
Definition: Utils.cpp:45
escript::convertToNumpy
void convertToNumpy(escript::Data data)
Definition: Utils.cpp:991
escript::printParallelThreadCnt
void printParallelThreadCnt()
print a message about how many MPI CPUs and OpenMP threads we're using
Definition: Utils.cpp:138
escript::setNumberOfThreads
void setNumberOfThreads(int num_threads)
set the number of threads
Definition: Utils.cpp:80
escript::getMPIRankWorld
int getMPIRankWorld()
returns the MPI processor number within MPI_COMM_WORLD
Definition: Utils.cpp:105
escript::getMachinePrecision
double getMachinePrecision()
returns the machine precision
Definition: Utils.cpp:369
system_dep.h