Alpine3D

Alpine3D Svn Source Tree

Root/trunk/alpine3d/OMPControl.h

1/***********************************************************************************/
2/* Copyright 2009-2015 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3/***********************************************************************************/
4/* This file is part of Alpine3D.
5 Alpine3D is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Alpine3D is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with Alpine3D. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef OMPCONTROL_H
19#define OMPCONTROL_H
20#include <meteoio/MeteoIO.h>
21#include <snowpack/libsnowpack.h>
22
23#include <cstdio>
24
25namespace OMPControl
26{
27 /**
28* @brief Returns the parameters for splitting an array in several, balanced sub-arrays.
29* This is mostly usefull for parallel calculations, where an array will be split and sent to different
30* workers.
31* @param[in] dimx number of cells in the desired dimension
32* @param[in] nbworkers total number of slices
33* @param[in] idx_wk current slice index (starting at 0)
34* @param[out] startx_sub calculated start index for the current slice
35* @param[out] nx_sub calculated number of cells (in the desired dimension) of the current slice
36*/
37 void getArraySliceParams(const size_t& dimx, const size_t& nbworkers, const size_t& idx_wk, size_t& startx_sub, size_t& nx_sub);
38 void getArraySliceParamsOptim(const size_t& nbworkers, const std::vector<SnowStation*>&, const mio::DEMObject& mpi_sub_dem,
39 const mio::Grid2DObject& mpi_sub_landuse, std::vector<std::vector<size_t> >& omp_snow_stations_ind);
40
41}
42#endif

Archive Download this file

Revision: HEAD