queso-0.53.0
ConstantVectorFunction.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2015 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #include <queso/ConstantVectorFunction.h>
26 #include <queso/GslVector.h>
27 #include <queso/GslMatrix.h>
28 
29 namespace QUESO {
30 
31 // Default constructor -----------------------------
32 template<class P_V,class P_M,class Q_V,class Q_M>
34  const char* prefix,
35  const VectorSet<P_V,P_M>& domainSet,
36  const VectorSet<Q_V,Q_M>& imageSet,
37  const Q_V& constantImageVector)
38  :
39  BaseVectorFunction<P_V,P_M,Q_V,Q_M>(((std::string)(prefix)+"gen").c_str(),
40  domainSet,
41  imageSet),
42  m_constantImageVector(NULL)
43 {
44  m_constantImageVector = new Q_V(constantImageVector);
45 }
46 
47 // Destructor ---------------------------------------
48 template<class P_V,class P_M,class Q_V,class Q_M>
50 {
51  delete m_constantImageVector;
52 }
53 
54 // Math methods -------------------------------------
55 template<class P_V,class P_M,class Q_V,class Q_M>
56 void
58  const P_V& domainVector,
59  const P_V* domainDirection,
60  Q_V& imageVector,
61  DistArray<P_V*>* gradVectors, // Yes, 'P_V'
62  DistArray<P_M*>* hessianMatrices, // Yes, 'P_M'
63  DistArray<P_V*>* hessianEffects) const
64 {
65  queso_require_msg(m_constantImageVector, "m_constantImageVector is NULL");
66 
67  imageVector = *m_constantImageVector;
68 
69  return;
70 }
71 
72 } // End namespace QUESO
73 
A templated (base) class for handling vector functions.
A class for handling vector functions which image is constant.
ConstantVectorFunction(const char *prefix, const VectorSet< P_V, P_M > &domainSet, const VectorSet< Q_V, Q_M > &imageSet, const Q_V &constantImageVector)
Default Constructor.
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
void compute(const P_V &domainVector, const P_V *domainDirection, Q_V &imageVector, DistArray< P_V * > *gradVectors, DistArray< P_M * > *hessianMatrices, DistArray< P_V * > *hessianEffects) const
Calculates the image vector: assigns to the protected attribute m_constantImageVector the value of th...
A class for partitioning vectors and matrices.
Definition: DistArray.h:56
virtual ~ConstantVectorFunction()
Destructor.

Generated on Thu Jun 11 2015 13:52:31 for queso-0.53.0 by  doxygen 1.8.5