Skip to content

Commit 6ae92a6

Browse files
committed
Add empty tool layer implementation.
1 parent af5d6a9 commit 6ae92a6

1 file changed

Lines changed: 149 additions & 0 deletions

File tree

include/opdi/tool/emptyTool.hpp

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/*
2+
* OpDiLib, an Open Multiprocessing Differentiation Library
3+
*
4+
* Copyright (C) 2020-2022 Chair for Scientific Computing (SciComp), TU Kaiserslautern
5+
* Copyright (C) 2023-2025 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
6+
* Homepage: https://scicomp.rptu.de
7+
* Contact: Prof. Nicolas R. Gauger (opdi@scicomp.uni-kl.de)
8+
*
9+
* Lead developer: Johannes Blühdorn (SciComp, University of Kaiserslautern-Landau)
10+
*
11+
* This file is part of OpDiLib (https://scicomp.rptu.de/software/opdi).
12+
*
13+
* OpDiLib is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
14+
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
15+
* version.
16+
*
17+
* OpDiLib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
18+
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
19+
* details.
20+
*
21+
* You should have received a copy of the GNU Lesser General Public License along with OpDiLib. If not, see
22+
* <http://www.gnu.org/licenses/>.
23+
*
24+
*/
25+
26+
#pragma once
27+
28+
#include "toolInterface.hpp"
29+
30+
namespace opdi {
31+
32+
struct EmptyTool : public ToolInterface {
33+
public:
34+
35+
// initialization and finalization
36+
void init() {}
37+
void finalize() {}
38+
39+
// tape creation and deletion
40+
41+
void* createTape() {
42+
return nullptr;
43+
}
44+
45+
void deleteTape(void* tape) {
46+
OPDI_UNUSED(tape);
47+
}
48+
49+
// management of thread local tapes
50+
51+
void* getThreadLocalTape() {
52+
return nullptr;
53+
}
54+
55+
void setThreadLocalTape(void* tape) {
56+
OPDI_UNUSED(tape);
57+
}
58+
59+
// position handling
60+
61+
void* allocPosition() {
62+
return nullptr;
63+
}
64+
65+
void freePosition(void* position) {
66+
OPDI_UNUSED(position);
67+
}
68+
69+
size_t getPositionSize() {
70+
return 0;
71+
}
72+
73+
std::string positionToString(void* position) {
74+
OPDI_UNUSED(position);
75+
return "";
76+
}
77+
78+
void getTapePosition(void* tape, void* position) {
79+
OPDI_UNUSED(tape);
80+
OPDI_UNUSED(position);
81+
}
82+
83+
void getZeroPosition(void* tape, void* position) {
84+
OPDI_UNUSED(tape);
85+
OPDI_UNUSED(position);
86+
}
87+
88+
void copyPosition(void* dst, void* src) {
89+
OPDI_UNUSED(dst);
90+
OPDI_UNUSED(src);
91+
}
92+
93+
int comparePosition(void* lhs, void* rhs) {
94+
OPDI_UNUSED(lhs);
95+
OPDI_UNUSED(rhs);
96+
return 0;
97+
}
98+
99+
// tape handling
100+
101+
bool isActive(void* tape) {
102+
OPDI_UNUSED(tape);
103+
return false;
104+
}
105+
106+
void setActive(void* tape, bool active) {
107+
OPDI_UNUSED(tape);
108+
OPDI_UNUSED(active);
109+
}
110+
111+
void evaluate(void* tape, void* start, void* end, bool useAtomics = true) {
112+
OPDI_UNUSED(tape);
113+
OPDI_UNUSED(start);
114+
OPDI_UNUSED(end);
115+
OPDI_UNUSED(useAtomics);
116+
}
117+
118+
void reset(void* tape, bool clearAdjoints = true) {
119+
OPDI_UNUSED(tape);
120+
OPDI_UNUSED(clearAdjoints);
121+
}
122+
123+
void reset(void* tape, void* position, bool clearAdjoints = true) {
124+
OPDI_UNUSED(tape);
125+
OPDI_UNUSED(position);
126+
OPDI_UNUSED(clearAdjoints);
127+
}
128+
129+
void pushExternalFunction(void* tape, Handle const* handle) {
130+
OPDI_UNUSED(tape);
131+
OPDI_UNUSED(handle);
132+
}
133+
134+
// tape editing
135+
136+
void erase(void* tape, void* start, void* end) {
137+
OPDI_UNUSED(tape);
138+
OPDI_UNUSED(start);
139+
OPDI_UNUSED(end);
140+
}
141+
142+
void append(void* dstTape, void* srcTape, void* start, void* end) {
143+
OPDI_UNUSED(dstTape);
144+
OPDI_UNUSED(srcTape);
145+
OPDI_UNUSED(start);
146+
OPDI_UNUSED(end);
147+
}
148+
};
149+
}

0 commit comments

Comments
 (0)