WSL/SLF GitLab Repository

Commit f5e21d57 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

The POPC parallel object version of MeteoIO has been removed: now the library...

The POPC parallel object version of MeteoIO has been removed: now the library can be compiled with popc so that all marshalling code is present, but it does NOT create a parallel object of its own. This means that the caller is 100% responsible for deciding what should go into its own parallel object.

Some documentation has been updated as well as better error messages in smetio.

The CMakeLists have been reworked according to some comments from the cmake mailing list.
parent e272422d
......@@ -21,6 +21,7 @@ SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") #for Visual C++ import libraries
###########################################################
#platform specific. First, compiler specific flags, then system specific flags
SET(DEBUG_ARITHM ON CACHE BOOL "Force crash the application when doing an arithmetic exception")
OPTION( BUILD_SHARED_LIBS "Set to OFF to build only static libraries" ON )
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(WARNINGS "-Wall")
......
......@@ -18,14 +18,8 @@
#ifndef __BUFFEREDIOHANDLER_H__
#define __BUFFEREDIOHANDLER_H__
#ifdef _POPC_
#include <meteoio/IOHandler.ph>
#else
#include <meteoio/IOHandler.h>
#endif
#include <meteoio/Config.h>
#include <map>
#include <vector>
#include <string>
......@@ -47,8 +41,8 @@ namespace mio {
* (10% by default)
* - BUFF_BEFORE: alternate way of buffer centering: When rebuffering, the new date will be located BUFF_BEFORE days from the
* begining of the buffer (therefore, it takes a value in days); [General] section, optional. Only one of
* two centering option can be used.
*
* two centering option can be used.
*
* @author Thomas Egger
* @date 2009-07-25
*/
......@@ -88,7 +82,7 @@ class BufferedIOHandler : public IOInterface {
} buffer_policy;
/**
* @brief Read the metadata for a given date.
* @brief Read the metadata for a given date.
* @param date date for which to read the metadata
* @param vecStation vector of metadata
*/
......
#OPTION( BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON )
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/")
SET(LIBPREFIX "lib") #make sure ALL plugins are libXXX for ALL plateforms
......
......@@ -15,17 +15,8 @@
You should have received a copy of the GNU Lesser General Public License
along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef _POPC_
#include <meteoio/IOHandler.ph>
#ifdef DEBUG_ARITHM
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <fenv.h>
#endif
#else
#include <meteoio/IOHandler.h>
#endif
#include <meteoio/IOHandler.h>
using namespace std;
......@@ -83,8 +74,7 @@ void IOHandler::registerPlugins()
#ifdef _POPC_
IOHandler::IOHandler(const std::string& configfile) : cfg(configfile), fileio(configfile){
#else
IOHandler::IOHandler(const std::string& configfile) : IOInterface(NULL), cfg(configfile), fileio(configfile)
{
IOHandler::IOHandler(const std::string& configfile) : IOInterface(NULL), cfg(configfile), fileio(configfile){
#endif
registerPlugins();
}
......@@ -108,9 +98,6 @@ IOHandler::IOHandler(const Config& cfgreader) : cfg(cfgreader), fileio(cfgreader
IOHandler::IOHandler(const Config& cfgreader) : IOInterface(NULL), cfg(cfgreader), fileio(cfgreader)
#endif
{
#if defined(_POPC_) && defined(DEBUG_ARITHM)
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
#endif
registerPlugins();
}
......
......@@ -18,9 +18,9 @@
#ifndef __IOHANDLER_H__
#define __IOHANDLER_H__
#ifdef _POPC_
/*#ifdef _POPC_
#error
#endif
#endif*/
#include <meteoio/IOInterface.h>
#include <meteoio/A3DIO.h>
......@@ -39,12 +39,22 @@ namespace mio {
* and it follows the interface defined by the IOInterface class with the addition of
* a few convenience methods.
*/
#ifdef _POPC_
class IOHandler {
#else
class IOHandler : public IOInterface {
#endif
public:
IOHandler(const std::string& configfile);
#ifndef _POPC_
IOHandler(const IOHandler&);
#endif
IOHandler(const Config&);
#ifdef _POPC_
~IOHandler();
#else
~IOHandler() throw();
#endif
//methods defined in the IOInterface class
virtual void read2DGrid(Grid2DObject& out_grid, const std::string& parameter="");
......@@ -52,8 +62,13 @@ class IOHandler : public IOInterface {
virtual void readLanduse(Grid2DObject& landuse_out);
virtual void readStationData(const Date& date,
STATION_TIMESERIE& vecStation);
#ifdef _POPC_
virtual void writeMeteoData(std::vector<METEO_TIMESERIE>& vecMeteo,
const std::string& name="");
#else
virtual void writeMeteoData(const std::vector<METEO_TIMESERIE>& vecMeteo,
const std::string& name="");
#endif
virtual void readMeteoData(const Date& dateStart, const Date& dateEnd,
std::vector<METEO_TIMESERIE>& vecMeteo,
const unsigned& stationindex=IOUtils::npos);
......@@ -63,14 +78,24 @@ class IOHandler : public IOInterface {
virtual void readSpecialPoints(std::vector<Coords>& pts);
virtual void write2DGrid(const Grid2DObject& grid_in, const std::string& name);
#ifndef _POPC_
friend std::ostream& operator<<(std::ostream& os, const IOHandler& data);
#endif
#ifdef _POPC_
std::string toString();
#else
std::string toString() const;
#endif
private:
void loadDynamicPlugins();
void loadPlugin(const std::string& libname, const std::string& classname,
DynamicLibrary*& dynLibrary, IOInterface*& io);
#ifdef _POPC_
void deletePlugin(DynamicLibrary*& dynLibrary, IOInterface*& io);
#else
void deletePlugin(DynamicLibrary*& dynLibrary, IOInterface*& io) throw();
#endif
void registerPlugins();
IOInterface *getPlugin(const std::string& cfgkey, const std::string& cfgsection="GENERAL");
......
......@@ -25,9 +25,7 @@ namespace mio {
IOManager::IOManager(const Config& i_cfg) : cfg(i_cfg), rawio(i_cfg), bufferedio(rawio, i_cfg), meteoprocessor(i_cfg)
{
setProcessingLevel(IOManager::filtered | IOManager::resampled);
fcache_start = fcache_end = Date(0.0, 0.); //this should not matter, since 0 is still way back before any real data...
meteoprocessor.getWindowSize(proc_properties);
}
......@@ -53,7 +51,7 @@ double IOManager::getAvgSamplingRate()
}
void IOManager::push_meteo_data(const ProcessingLevel& level, const Date& date_start, const Date& date_end,
const std::vector< METEO_TIMESERIE >& vecMeteo)
const std::vector< METEO_TIMESERIE >& vecMeteo)
{
//perform check on date_start and date_end
if (date_end < date_start)
......@@ -89,7 +87,7 @@ size_t IOManager::getStationData(const Date& date, STATION_TIMESERIE& vecStation
//for an interval of data: decide whether data should be filtered or raw
size_t IOManager::getMeteoData(const Date& dateStart, const Date& dateEnd,
std::vector< METEO_TIMESERIE >& vecMeteo)
std::vector< METEO_TIMESERIE >& vecMeteo)
{
vecMeteo.clear();
......@@ -127,10 +125,7 @@ void IOManager::fill_filtered_cache()
if ((IOManager::filtered & processing_level) == IOManager::filtered){
//ask the bufferediohandler for the whole buffer
const vector< METEO_TIMESERIE >& buffer = bufferedio.get_complete_buffer(fcache_start, fcache_end);
//cout << "Now filtering ... data for " << buffer.size() << " stations" << endl; clock_t cstart = std::clock();
meteoprocessor.process(buffer, filtered_cache);
//cout << "Filtering: " << ( std::clock() - cstart ) / (double)CLOCKS_PER_SEC << " seconds" << endl;
}
}
......
......@@ -420,6 +420,14 @@ class USERInterpolation : public InterpolationAlgorithm {
* to the method described in <i>"Quantitative evaluation of different hydrological modelling approaches
* in a partly glacierized Swiss watershed"</i>, Magnusson et All., Hydrological Processes, 2010, under review and
* <i>"Modelling runoff from highly glacierized alpine catchments in a changing climate"</i>, Huss et All., Hydrological Processes, <b>22</b>, 3888-3902, 2008.
*
* An example using this algorithm, initializing the grid with a constant lapse rate fill using +0.05% precipitation increase per meter of elevation, is given below:
* @code
* HNW::algorithms = HNW_SNOW
* HNW::hnw_snow = cst_lapse
* HNW::cst_lapse = 0.0005 frac
* @endcode
*
* @author Florian Kobierska, Jan Magnusson and Mathias Bavay
*/
class SnowHNWInterpolation : public InterpolationAlgorithm {
......
......@@ -36,9 +36,9 @@
#include <meteoio/Grid3DObject.h>
#include <meteoio/InterpolationAlgorithms.h>
#include <meteoio/IOExceptions.h>
//#include <meteoio/IOHandler.h> //special case for popc
#include <meteoio/IOHandler.h>
#include <meteoio/IOInterface.h>
//#include <meteoio/IOManager.h> //special case for popc
#include <meteoio/IOManager.h>
#include <meteoio/IOPlugin.h>
#include <meteoio/IOUtils.h>
#include <meteoio/libfit1D.h>
......@@ -72,12 +72,7 @@
#include <meteoio/Timer.h>
#ifdef _POPC_
#include <meteoio/IOHandler.ph>
#include <meteoio/IOManager.h> //HACK
#include <meteoio/marshal_meteoio.h>
#else
#include <meteoio/IOHandler.h>
#include <meteoio/IOManager.h>
#endif
#endif
OPTION( BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON )
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/")
if(COMMAND cmake_policy)
......@@ -45,7 +44,6 @@ ENDIF(DEST MATCHES "par")
IF(PLUGIN_SMETIO)
ADD_LIBRARY(${SMETIONAME} SMETIO.cc)
#SET_TARGET_PROPERTIES(${SMETIONAME} PROPERTIES LINKER_LANGUAGE C)
TARGET_LINK_LIBRARIES(${SMETIONAME} ${SHAREDNAME})
SET_TARGET_PROPERTIES(${SMETIONAME} PROPERTIES
PREFIX "${LIBPREFIX}"
......
......@@ -529,8 +529,12 @@ void SMETIO::readDataAscii(const char& eoln, const std::string& filename, const
poscounter++;
} else {
double val;
if (!IOUtils::convertString(val, tmpvec[ii]))
throw InvalidFormatException("In "+filename+": Invalid value for param", AT);
if (!IOUtils::convertString(val, tmpvec[ii])) {
std::stringstream ss;
ss << "In " << filename << ":" << md.date.toString(Date::ISO);
ss << " Invalid value for " << vecDataSequence[ii] << " = \"" << tmpvec[ii] << "\" ";
throw InvalidFormatException(ss.str(), AT);
}
if(val==plugin_nodata)
SMETIO::getParameter(vecDataSequence[ii], md) = IOUtils::nodata;
else
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment