queso-0.53.0
GenericScalarCovarianceFunction.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/GenericScalarCovarianceFunction.h>
26 
27 namespace QUESO {
28 
29 // Default constructor -----------------------------
30 template<class V,class M>
32  const char* prefix,
33  const VectorSet<V,M>& domainSet,
34  double (*covRoutinePtr)(const V& positionVector1, const V& positionVector2, const void* routineDataPtr),
35  const void* routinesDataPtr)
36  :
37  BaseScalarCovarianceFunction<V,M>(prefix,domainSet),
38  m_covRoutinePtr (covRoutinePtr),
39  m_routineDataPtr (routinesDataPtr)
40 {
41  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
42  *m_env.subDisplayFile() << "Entering GenericScalarCovarianceFunction<V,M>::constructor()"
43  << ": prefix = " << m_prefix
44  << std::endl;
45  }
46 
47  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
48  *m_env.subDisplayFile() << "Leaving GenericScalarCovarianceFunction<V,M>::constructor()"
49  << ": prefix = " << m_prefix
50  << std::endl;
51  }
52 }
53 // Destructor ---------------------------------------
54 template<class V,class M>
56 {
57  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
58  *m_env.subDisplayFile() << "Entering GenericScalarCovarianceFunction<V,M>::destructor()"
59  << ": prefix = " << m_prefix
60  << std::endl;
61  }
62 
63  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
64  *m_env.subDisplayFile() << "Leaving GenericScalarCovarianceFunction<V,M>::destructor()"
65  << ": prefix = " << m_prefix
66  << std::endl;
67  }
68 }
69 // Math methods -------------------------------------
70 template<class V,class M>
71 double
72 GenericScalarCovarianceFunction<V,M>::value(const V& positionVector1, const V& positionVector2) const
73 {
74  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
75  *m_env.subDisplayFile() << "Entering GenericScalarCovarianceFunction<V,M>::value()"
76  << std::endl;
77  }
78 
79  queso_require_msg(m_covRoutinePtr, "m_covRoutinePtr = NULL");
80 
81  double result = m_covRoutinePtr(positionVector1, positionVector2, m_routineDataPtr);
82 
83  if ((m_env.subDisplayFile()) && (m_env.displayVerbosity() >= 54)) {
84  *m_env.subDisplayFile() << "Leaving GenericScalarCovarianceFunction<V,M>::value()"
85  << std::endl;
86  }
87 
88  return result;
89 }
90 
91 } // End namespace QUESO
unsigned int displayVerbosity() const
Definition: Environment.C:396
A templated class for handling sets.
Definition: VectorSet.h:52
double value(const V &positionVector1, const V &positionVector2) const
Calculates the value of the generic covariance function.
GenericScalarCovarianceFunction(const char *prefix, const VectorSet< V, M > &domainSet, double(*covRoutinePtr)(const V &positionVector1, const V &positionVector2, const void *routineDataPtr), const void *routinesDataPtr)
Default constructor.
virtual ~GenericScalarCovarianceFunction()
Virtual destructor.
#define queso_require_msg(asserted, msg)
Definition: asserts.h:69
std::ofstream * subDisplayFile() const
Access function for m_subDisplayFile (displays file on stream).
Definition: Environment.C:274
A templated (base) class to accommodate scalar covariance functions (of random variables).

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