queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
GenericVectorFunction.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-2017 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/GenericVectorFunction.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  void (*routinePtr)(const P_V& domainVector,
38  const P_V* domainDirection,
39  const void* functionDataPtr,
40  Q_V& imageVector,
41  DistArray<P_V*>* gradVectors,
42  DistArray<P_M*>* hessianMatrices,
43  DistArray<P_V*>* hessianEffects),
44  const void* functionDataPtr)
45  :
46  BaseVectorFunction<P_V,P_M,Q_V,Q_M>(((std::string)(prefix)+"gen").c_str(),
47  domainSet,
48  imageSet),
49  m_routinePtr (routinePtr),
50  m_routineDataPtr(functionDataPtr)
51 {
52 }
53 
54 // Destructor ---------------------------------------
55 template<class P_V,class P_M,class Q_V,class Q_M>
57 {
58 }
59 
60 // Math methods -------------------------------------
61 template<class P_V,class P_M,class Q_V,class Q_M>
62 void
64  const P_V& domainVector,
65  const P_V* domainDirection,
66  Q_V& imageVector,
67  DistArray<P_V*>* gradVectors, // Yes, 'P_V'
68  DistArray<P_M*>* hessianMatrices, // Yes, 'P_M'
69  DistArray<P_V*>* hessianEffects) const
70 {
71 
72  // domainVector.env().worldRank(),
73  // "GenericVectorFunction<P_V,P_M,Q_V,Q_M>::compute()",
74  // "this method should not be called in the case of this class");
75 
76  m_routinePtr(domainVector, domainDirection, m_routineDataPtr, imageVector, gradVectors, hessianMatrices, hessianEffects);
77 
78  return;
79 }
80 
81 } // End namespace QUESO
82 
A templated (base) class for handling vector functions.
virtual ~GenericVectorFunction()
Virtual destructor.
A class for handling generic vector functions.
A class for partitioning vectors and matrices.
Definition: DistArray.h:56
GenericVectorFunction(const char *prefix, const VectorSet< P_V, P_M > &domainSet, const VectorSet< Q_V, Q_M > &imageSet, void(*routinePtr)(const P_V &domainVector, const P_V *domainDirection, const void *functionDataPtr, Q_V &imageVector, DistArray< P_V * > *gradVectors, DistArray< P_M * > *hessianMatrices, DistArray< P_V * > *hessianEffects), const void *functionDataPtr)
Default constructor.
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
Calls the protected member *m_routinePtr(), in order to calculate the image vector imageVector...

Generated on Tue Jun 5 2018 19:48:54 for queso-0.57.1 by  doxygen 1.8.5