1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
/***********************************************/
/**
* @file grid.cpp
*
* @brief point distributions on the sphere/ellipsoid.
*
* @author Torsten Mayer-Guerr
* @date 2002-05-31
*
*/
/***********************************************/
#define DOCSTRING_Grid
#include "base/import.h"
#include "config/configRegister.h"
#include "classes/grid/gridGeograph.h"
#include "classes/grid/gridTriangleVertex.h"
#include "classes/grid/gridTriangleCenter.h"
#include "classes/grid/gridGauss.h"
#include "classes/grid/gridReuter.h"
#include "classes/grid/gridCorput.h"
#include "classes/grid/gridDriscoll.h"
#include "classes/grid/gridSinglePoint.h"
#include "classes/grid/gridSinglePointCartesian.h"
#include "classes/grid/gridFile.h"
#include "classes/grid/grid.h"
/***********************************************/
GROOPS_REGISTER_CLASS(Grid, "gridType",
GridGeograph,
GridTriangleVertex,
GridTriangleCenter,
GridGauss,
GridReuter,
GridCorput,
GridDriscoll,
GridSinglePoint,
GridSinglePointCartesian,
GridFile)
GROOPS_READCONFIG_UNBOUNDED_CLASS(Grid, "gridType")
/***********************************************/
Grid::Grid(Config &config, const std::string &name)
{
try
{
std::unique_ptr<GridBase> base;
std::string choice;
while(readConfigChoice(config, name, choice, Config::OPTIONAL, "", "point distributions on the sphere/ellipsoid"))
{
if(readConfigChoiceElement(config, "geograph", choice, "along lines of geographical coordinates"))
base = std::unique_ptr<GridBase>(new GridGeograph(config));
if(readConfigChoiceElement(config, "triangleVertex", choice, "triangle grid (vertcies)"))
base = std::unique_ptr<GridBase>(new GridTriangleVertex(config));
if(readConfigChoiceElement(config, "triangleCenter", choice, "triangle grid (center points)"))
base = std::unique_ptr<GridBase>(new GridTriangleCenter(config));
if(readConfigChoiceElement(config, "gauss", choice, "gauss-legendre grid"))
base = std::unique_ptr<GridBase>(new GridGauss(config));
if(readConfigChoiceElement(config, "reuter", choice, "reuter grid"))
base = std::unique_ptr<GridBase>(new GridReuter(config));
if(readConfigChoiceElement(config, "corput", choice, "pseudo random distribution"))
base = std::unique_ptr<GridBase>(new GridCorput(config));
if(readConfigChoiceElement(config, "driscoll", choice, "driscoll-healy grid"))
base = std::unique_ptr<GridBase>(new GridDriscoll(config));
if(readConfigChoiceElement(config, "singlePoint", choice, "one single point"))
base = std::unique_ptr<GridBase>(new GridSinglePoint(config));
if(readConfigChoiceElement(config, "singlePointCartesian", choice, "one single point"))
base = std::unique_ptr<GridBase>(new GridSinglePointCartesian(config));
if(readConfigChoiceElement(config, "file", choice, "read points (with values) from file"))
base = std::unique_ptr<GridBase>(new GridFile(config));
endChoice(config);
if(isCreateSchema(config))
return;
if(points_.empty())
{
std::swap(points_, base->points);
std::swap(areas_, base->areas);
}
else
{
points_.insert(points_.end(), base->points.begin(), base->points.end());
areas_.insert (areas_.end(), base->areas.begin(), base->areas.end());
}
}
}
catch(std::exception &e)
{
GROOPS_RETHROW(e)
}
}
/***********************************************/
|