51 template<
class Scalar,
class UserVector>
54 std::vector<EIntrepidBurkardt> rule1D,
55 std::vector<EIntrepidGrowth> growth1D,
59 TEUCHOS_TEST_FOR_EXCEPTION((dimension!=(
int)rule1D.size()||
60 dimension!=(int)growth1D.size()),std::out_of_range,
61 ">>> ERROR (AdaptiveSparseGridInterface): Dimension mismatch for inputs.");
63 dimension_ = dimension;
67 isNormalized_ = isNormalized;
70 template<
class Scalar,
class UserVector>
72 std::vector<int> index(dimension_,1);
74 dimension_,index,rule1D_,growth1D_,isNormalized_);
78 output.Update(-1.0,output);
79 eval_cubature(output,cubRule);
82 initialDiff_ = error_indicator(output);
83 if (std::abs(initialDiff_)<INTREPID_TOL)
87 template<
class Scalar,
class UserVector>
89 std::vector<int> index) {
90 int dimension = (int)index.size();
92 for (
int i=0; i<dimension; i++) {
95 if (sum <= maxLevel_ + dimension - 1)
100 template<
class Scalar,
class UserVector>
107 std::vector<Scalar> point(dimension_,(Scalar)0.0);
109 Teuchos::RCP<UserVector> f = output.Create(); output.Update(-1.0,output);
111 typename std::map<std::vector<Scalar>,
int>::iterator it;
112 for (it=cubRule.
begin(); it!=cubRule.
end(); it++) {
114 point.assign((it->first).begin(),(it->first).end());
116 eval_integrand(*f,point);
120 output.Update(weight,*f);
124 template<
class Scalar,
class UserVector>
126 std::vector<EIntrepidBurkardt> & rule1D) {
128 rule1D.resize(rule1D_.size());
132 template<
class Scalar,
class UserVector>
134 std::vector<EIntrepidGrowth> & growth1D) {
136 growth1D.resize(growth1D_.size());
137 growth1D = growth1D_;
140 template<
class Scalar,
class UserVector>
145 template<
class Scalar,
class UserVector>
147 return isNormalized_;
150 template<
class Scalar,
class UserVector>
std::map< std::vector< Scalar >, int >::iterator begin()
Initiate iterator at the beginning of data.
void getRule(std::vector< EIntrepidBurkardt > &rule1D)
Return user defined 1D quadrature rules.
Scalar getInitialDiff()
Return initial error indicator.
int getDimension()
Return dimension of integration domain.
void init(UserVector &output)
Compute initial quantities for sparse grid adaptation.
Scalar getWeight(int node)
Get a specific weight described by the integer location.
AdaptiveSparseGridInterface(int dimension, std::vector< EIntrepidBurkardt > rule1D, std::vector< EIntrepidGrowth > growth1D, int maxLevel, bool isNormalized)
Constructor starts with index [1,...,1].
bool isNormalized()
Return whether or not cubature weights are normalized.
virtual bool max_level(std::vector< int > index)
User defined test for maximum level of cubature.
virtual void eval_cubature(UserVector &output, CubatureTensorSorted< Scalar > &cubRule)
Evaluate the cubature rule.
void getGrowth(std::vector< EIntrepidGrowth > &growth1D)
Return user defined 1D growth rules.
Utilizes 1D cubature (integration) rules contained in the library sandia_rules (John Burkardt...
std::map< std::vector< Scalar >, int >::iterator end()
Initiate iterator at the end of data.