Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
parameterlist
src
Teuchos_StandardFunctionObjectXMLConverters.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Teuchos: Common Tools Package
4
//
5
// Copyright 2004 NTESS and the Teuchos contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef TEUCHOS_STANDARDFUNCTIONOBJECTXMLCONVERTERS_HPP
11
#define TEUCHOS_STANDARDFUNCTIONOBJECTXMLCONVERTERS_HPP
12
16
17
18
#include "
Teuchos_FunctionObjectXMLConverter.hpp
"
19
#include "Teuchos_StandardFunctionObjects.hpp"
20
21
22
namespace
Teuchos
{
23
24
26
template
<
class
OperandType>
27
class
SimpleFunctionXMLConverter
:
public
FunctionObjectXMLConverter
{
28
29
public
:
30
33
40
virtual
RCP<SimpleFunctionObject<OperandType>
>
41
getSpecificSimpleFunction
(OperandType operand)
const
= 0;
42
50
virtual
void
getSpecialSimpleFunctionXMLTraits
(
51
const
RCP
<
const
SimpleFunctionObject<OperandType>
>
/* functionObject */
,
52
XMLObject
&
/* xmlObj */
)
const
{}
53
55
58
60
RCP<FunctionObject>
61
convertXML
(
const
XMLObject
& xmlObj)
const
;
62
64
void
convertFunctionObject
(
65
const
RCP<const FunctionObject>
functionObject,
66
XMLObject
& xmlObj)
const
;
67
69
71
72
73
static
std::string getOperandAttributeName(){
74
static
const
std::string operandAttributeName =
"operand"
;
75
return
operandAttributeName;
76
}
77
79
80
};
81
82
template
<
class
OperandType>
83
RCP<FunctionObject>
84
SimpleFunctionXMLConverter<OperandType>::convertXML
(
85
const
XMLObject
& xmlObj)
const
86
{
87
OperandType operand =
88
xmlObj.
getRequired
<OperandType>(getOperandAttributeName());
89
return
getSpecificSimpleFunction
(operand);
90
}
91
92
template
<
class
OperandType>
93
void
SimpleFunctionXMLConverter<OperandType>::convertFunctionObject
(
94
const
RCP<const FunctionObject>
functionObject,
95
XMLObject
& xmlObj)
const
96
{
97
RCP<const SimpleFunctionObject<OperandType>
> castedFunction =
98
rcp_dynamic_cast<const SimpleFunctionObject<OperandType>
>(
99
functionObject,
true
);
100
OperandType operand = castedFunction->getModifiyingOperand();
101
xmlObj.
addAttribute
(getOperandAttributeName(),operand);
102
getSpecialSimpleFunctionXMLTraits
(castedFunction, xmlObj);
103
}
104
113
template
<
class
OperandType>
114
class
SubtractionFunctionXMLConverter
:
115
public
SimpleFunctionXMLConverter
<OperandType>
116
{
117
public
:
118
121
123
RCP<SimpleFunctionObject<OperandType>
>
124
getSpecificSimpleFunction
(OperandType operand)
const
;
125
127
};
128
129
template
<
class
OperandType>
130
RCP<SimpleFunctionObject<OperandType>
>
131
SubtractionFunctionXMLConverter<OperandType>::getSpecificSimpleFunction
(
132
OperandType operand)
const
133
{
134
return
rcp
(
new
SubtractionFunction<OperandType>
(operand));
135
}
136
145
template
<
class
OperandType>
146
class
AdditionFunctionXMLConverter
:
147
public
SimpleFunctionXMLConverter
<OperandType>
148
{
149
public
:
150
153
155
RCP<SimpleFunctionObject<OperandType>
>
156
getSpecificSimpleFunction
(OperandType operand)
const
;
157
159
};
160
161
template
<
class
OperandType>
162
RCP<SimpleFunctionObject<OperandType>
>
163
AdditionFunctionXMLConverter<OperandType>::getSpecificSimpleFunction
(
164
OperandType operand)
const
165
{
166
return
rcp
(
new
AdditionFunction<OperandType>
(operand));
167
}
168
177
template
<
class
OperandType>
178
class
MultiplicationFunctionXMLConverter
:
179
public
SimpleFunctionXMLConverter
<OperandType>
180
{
181
public
:
182
185
187
RCP<SimpleFunctionObject<OperandType>
>
188
getSpecificSimpleFunction
(OperandType operand)
const
;
189
191
};
192
193
template
<
class
OperandType>
194
RCP<SimpleFunctionObject<OperandType>
>
195
MultiplicationFunctionXMLConverter<OperandType>::getSpecificSimpleFunction
(
196
OperandType operand)
const
197
{
198
return
rcp
(
new
MultiplicationFunction<OperandType>
(operand));
199
}
200
209
template
<
class
OperandType>
210
class
DivisionFunctionXMLConverter
:
211
public
SimpleFunctionXMLConverter
<OperandType>
212
{
213
public
:
214
217
219
RCP<SimpleFunctionObject<OperandType>
>
220
getSpecificSimpleFunction
(OperandType operand)
const
;
221
223
};
224
225
template
<
class
OperandType>
226
RCP<SimpleFunctionObject<OperandType>
>
227
DivisionFunctionXMLConverter<OperandType>::getSpecificSimpleFunction
(
228
OperandType operand)
const
229
{
230
return
rcp
(
new
DivisionFunction<OperandType>
(operand));
231
}
232
233
234
}
// namespace Teuchos
235
236
237
#endif
// TEUCHOS_STANDARDFUNCTIONOBJECTXMLCONVERTERS_HPP
238
Teuchos_FunctionObjectXMLConverter.hpp
Converts back and forth between XML and FunctionObjects.
Teuchos::AdditionFunction
A simple function object that adds a specififed value from the given arguement in the runFunction fun...
Definition
Teuchos_StandardFunctionObjects.hpp:166
Teuchos::AdditionFunctionXMLConverter
Class for converting AdditionFunction objects to and from XML.
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:148
Teuchos::AdditionFunctionXMLConverter::getSpecificSimpleFunction
RCP< SimpleFunctionObject< OperandType > > getSpecificSimpleFunction(OperandType operand) const
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:163
Teuchos::DivisionFunction
A simple function object that divides a specififed value from the given arguement in the runFunction ...
Definition
Teuchos_StandardFunctionObjects.hpp:285
Teuchos::DivisionFunctionXMLConverter
Class for converting DivisionFunction objects to and from XML.
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:212
Teuchos::DivisionFunctionXMLConverter::getSpecificSimpleFunction
RCP< SimpleFunctionObject< OperandType > > getSpecificSimpleFunction(OperandType operand) const
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:227
Teuchos::FunctionObjectXMLConverter
An abstract base class for converting FunctionObjects to and from XML.
Definition
Teuchos_FunctionObjectXMLConverter.hpp:32
Teuchos::MultiplicationFunction
A simple function object that multiplys a specififed value from the given arguement in the runFunctio...
Definition
Teuchos_StandardFunctionObjects.hpp:225
Teuchos::MultiplicationFunctionXMLConverter
Class for converting MultiplicationFunction objects to and from XML.
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:180
Teuchos::MultiplicationFunctionXMLConverter::getSpecificSimpleFunction
RCP< SimpleFunctionObject< OperandType > > getSpecificSimpleFunction(OperandType operand) const
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:195
Teuchos::RCP
Smart reference counting pointer class for automatic garbage collection.
Definition
Teuchos_RCPDecl.hpp:397
Teuchos::RCP::rcp_dynamic_cast
RCP< T2 > rcp_dynamic_cast(const RCP< T1 > &p1, bool throw_on_fail=false)
Dynamic cast of underlying RCP type from T1* to T2*.
Teuchos::SimpleFunctionObject
A simple function object that applies a given operand to a spcified arguement using a specific operat...
Definition
Teuchos_StandardFunctionObjects.hpp:28
Teuchos::SimpleFunctionXMLConverter
An xml converter for SimpleFunctionObjects.
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:27
Teuchos::SimpleFunctionXMLConverter::getSpecialSimpleFunctionXMLTraits
virtual void getSpecialSimpleFunctionXMLTraits(const RCP< const SimpleFunctionObject< OperandType > >, XMLObject &) const
Add and extra XML traits that are specific to a certain FuncitonOjbect when converting that function ...
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:50
Teuchos::SimpleFunctionXMLConverter::convertXML
RCP< FunctionObject > convertXML(const XMLObject &xmlObj) const
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:84
Teuchos::SimpleFunctionXMLConverter::getSpecificSimpleFunction
virtual RCP< SimpleFunctionObject< OperandType > > getSpecificSimpleFunction(OperandType operand) const =0
Gets the specific SimpleFunction to be returned by this converter when converting from XML.
Teuchos::SimpleFunctionXMLConverter::convertFunctionObject
void convertFunctionObject(const RCP< const FunctionObject > functionObject, XMLObject &xmlObj) const
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:93
Teuchos::SubtractionFunction
A simple function object that subtracts a specififed value from the given arguement in the runFunctio...
Definition
Teuchos_StandardFunctionObjects.hpp:107
Teuchos::SubtractionFunctionXMLConverter
Class for converting SubtractionFunction objects to and from XML.
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:116
Teuchos::SubtractionFunctionXMLConverter::getSpecificSimpleFunction
RCP< SimpleFunctionObject< OperandType > > getSpecificSimpleFunction(OperandType operand) const
Definition
Teuchos_StandardFunctionObjectXMLConverters.hpp:131
Teuchos::XMLObject
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object,...
Definition
Teuchos_XMLObject.hpp:30
Teuchos::XMLObject::getRequired
const std::string & getRequired(const std::string &name) const
Get an attribute, throwing an std::exception if it is not found.
Definition
Teuchos_XMLObject.cpp:61
Teuchos::XMLObject::addAttribute
void addAttribute(const std::string &name, T value)
Lookup whether or not Doubles are allowed.
Definition
Teuchos_XMLObject.hpp:161
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Teuchos::rcp
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
Definition
Teuchos_RCPDecl.hpp:1234
Generated by
1.17.0