CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
internalAdjointsInterface.hpp
1/*
2 * CoDiPack, a Code Differentiation Package
3 *
4 * Copyright (C) 2015-2024 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
5 * Homepage: http://scicomp.rptu.de
6 * Contact: Prof. Nicolas R. Gauger (codi@scicomp.uni-kl.de)
7 *
8 * Lead developers: Max Sagebaum, Johannes Blühdorn (SciComp, University of Kaiserslautern-Landau)
9 *
10 * This file is part of CoDiPack (http://scicomp.rptu.de/software/codi).
11 *
12 * CoDiPack is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * CoDiPack is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty
19 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * See the GNU General Public License for more details.
22 * You should have received a copy of the GNU
23 * General Public License along with CoDiPack.
24 * If not, see <http://www.gnu.org/licenses/>.
25 *
26 * For other licensing options please contact us.
27 *
28 * Authors:
29 * - SciComp, University of Kaiserslautern-Landau:
30 * - Max Sagebaum
31 * - Johannes Blühdorn
32 * - Former members:
33 * - Tim Albring
34 */
35#pragma once
36
37#include "../../misc/macros.hpp"
38#include "../interfaces/fullTapeInterface.hpp"
39
41namespace codi {
42
79 template<typename T_Gradient, typename T_Identifier, typename T_Tape>
81 public:
82
85 using Gradient = CODI_DD(T_Gradient, double);
86 using Identifier = CODI_DD(T_Identifier, int);
87
90 InternalAdjointsInterface(size_t initialSize) {
91 CODI_UNUSED(initialSize);
92 }
93
96
98 CODI_INLINE Gradient const& operator[](Identifier const& identifier) const;
99
102
104 CODI_INLINE size_t size() const;
105
107 CODI_NO_INLINE void resize(Identifier const& newSize);
108
111
113 template<typename Impl>
114 CODI_INLINE void swap(Impl& other);
115
118
121 };
122
123}
#define CODI_NO_INLINE
See codi::Config::AvoidedInlines.
Definition config.h:417
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition config.h:457
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:94
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition macros.hpp:111
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
void CODI_UNUSED(Args const &...)
Disable unused warnings for an arbitrary number of arguments.
Definition macros.hpp:46
Full tape interface that supports all features of CoDiPack.
Definition fullTapeInterface.hpp:82
Abstracts the internal set of adjoint variables provided as part of the tape.
Definition internalAdjointsInterface.hpp:80
void resize(Identifier const &newSize)
Ensure that identifiers up to newSize can be passed to operator[] without error.
void endUse()
Declare that the adjoints are no longer occupied.
T_Gradient Gradient
See InternalAdjointsInterface.
Definition internalAdjointsInterface.hpp:85
InternalAdjointsInterface(size_t initialSize)
Definition internalAdjointsInterface.hpp:90
size_t size() const
Returns the number of adjoint variables. Internally, declares usage of the adjoints.
void zeroAll()
Set all adjoint variables to Gradient().
Gradient const & operator[](Identifier const &identifier) const
Constant reference access to the adjoint variable identified by identifier.
Gradient * data()
Pointer to an underlying array implementation.
T_Tape Tape
See InternalAdjointsInterface.
Definition internalAdjointsInterface.hpp:84
void beginUse()
Declare that the adjoints are in use, e.g., during a tape evaluation, and cannot be resized right now...
void swap(Impl &other)
Swap two sets of adjoint variables. Internally, declares usage of the adjoints.
T_Identifier Identifier
See InternalAdjointsInterface.
Definition internalAdjointsInterface.hpp:86
Gradient & operator[](Identifier const &identifier)
Reference access to the adjoint variable identified by identifier.