-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtsgBaseGrid.hpp
76 lines (62 loc) · 2.95 KB
/
tsgBaseGrid.hpp
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
/*
* Code Author: Miroslav Stoyanov, Mar 2013
*
* Copyright (C) 2013 Miroslav Stoyanov
*
* This file is part of
* Toolkit for Adaprive Stochastic Modeling And Non-Intrusive Approximation
* a.k.a. TASMANIAN
*
* TASMANIAN is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TASMANIAN is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TASMANIAN. If not, see <http://www.gnu.org/licenses/>
*
*/
#ifndef __TASMANIAN_SPARSE_GRID_BASE_GRID_HPP
#define __TASMANIAN_SPARSE_GRID_BASE_GRID_HPP
#include "tsgEnumerate.hpp"
#include "tsgHelperFunctions.hpp"
#include "tsgIndexSet.hpp"
namespace TasGrid{
class Grid{
public:
Grid();
virtual ~Grid();
//virtual void reset( int dimensions, int outputs, int depth, DepthType type, OneDRules oned );
//virtual void reset( int outputs );
virtual int getNumDimensions() const;
virtual int getNumOutputs() const;
virtual TypeOneDRule getOneDRule() const;
virtual const char *getOneDRuleDescription() const;
virtual void write( std::ofstream &ofs ) const; // write the grid to a file
virtual bool read( std::ifstream &ifs ); // reads the grid
virtual int getNumPoints() const;
virtual void getPoints( double* &pnts ) const;
virtual void getWeights( double* &weights ) const;
virtual void getInterpolantWeights( const double x[], double* &weights ) const;
virtual int getNumNeededPoints() const;
virtual void getNeededPoints( double* &pnts ) const;
virtual void loadNeededPoints( const double vals[] );
virtual void loadNeededPoints( const IndexSet *data );
virtual void evaluate( const double x[], double y[] ) const;
virtual void integrate( double y[] ) const;
// refinement functions
virtual const IndexSet* getState() const; // returns enough information to rebuild the grid (i.e. the tensor list or the points list)
virtual void setState( const IndexSet* state ); // copy the tensors and/or points
//virtual const IndexSet* getData() const; // returns the point set associated with the values (if any)
virtual void getData( IndexSet* &data ); // returns a list of the set points and their values
virtual void getUpdateState( IndexSet* &update, double tol, TypeRefinement criteria ) const; // give the new set of points or tensors
virtual void setUpdate( const IndexSet *update ); // creates a grid with the data updates
// setUpdate loses all loaded data
};
}
#endif