Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8f17fa6

Browse files
committedDec 13, 2024··
Changes for compiling in v2112 AD mode.
1 parent 21620ee commit 8f17fa6

File tree

7 files changed

+53
-6
lines changed

7 files changed

+53
-6
lines changed
 

‎Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
default:
2-
(cd src && python setup.py build_ext --inplace)
3-
(mv src/*.so pyofm)
2+
(cd src && ./Allmake && cd -)
43

54
clean:
6-
(cd src && rm -rf *.cpp *.so build)
5+
(cd src && ./Allclean && cd -)
76
(rm -rf */__pycache__ */*/__pycache__)

‎src/Allclean

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
rm -rf build *.so *.cpp *.h
4+
wclean

‎src/Allmake

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
# the script will exit if there is any error
4+
set -e
5+
6+
if [ -z "$WM_PROJECT" ]; then
7+
echo "OpenFOAM environment not found, forgot to source the OpenFOAM bashrc?"
8+
exit 1
9+
fi
10+
11+
cythonize -3 pyOFMesh.pyx
12+
wmake -j
13+
cp -r *.so ../pyofm/

‎src/Make/files

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
OFMesh.C
2+
pyOFMesh.cpp
3+
4+
LIB = pyOFMesh.$(shell python3 -c 'import sysconfig; ext_suffix = sysconfig.get_config_var("EXT_SUFFIX"); print(ext_suffix.split(".")[1])')

‎src/Make/options

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
EXE_INC = \
2+
-I$(LIB_SRC)/finiteVolume/lnInclude \
3+
-I$(LIB_SRC)/sampling/lnInclude \
4+
-I$(LIB_SRC)/meshTools/lnInclude \
5+
-I$(LIB_SRC)/fileFormats/lnInclude \
6+
-I$(LIB_SRC)/surfMesh/lnInclude \
7+
-I$(MPI_ARCH_PATH)/include \
8+
-I$(MPI_ARCH_PATH)/include64 \
9+
$(shell python3 -c "import numpy; print('-I' + numpy.get_include())") \
10+
$(shell python3-config --includes) \
11+
12+
13+
LIB_LIBS = \
14+
-lmeshTools \
15+
-lfiniteVolume \
16+
-L$(MPI_ARCH_PATH)/lib \
17+
-L$(MPI_ARCH_PATH)/lib64 \
18+
$(shell python3-config --ldflags)

‎src/OFMesh.H

+10-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public:
6666
const label pointI,
6767
const label compI) const
6868
{
69-
#if defined(CODI_AD_FORWARD) || defined(CODI_AD_REVERSE)
69+
#if defined(DAOF_AD_MODE_T1S) || defined(DAOF_AD_MODE_A1S)
7070
return meshPtr_().points()[pointI][compI].getValue();
7171
#else
7272
return meshPtr_().points()[pointI][compI];
@@ -192,7 +192,11 @@ public:
192192

193193
forAll(state, cellI)
194194
{
195+
#if defined(DAOF_AD_MODE_T1S) || defined(DAOF_AD_MODE_A1S)
196+
field[cellI] = state[cellI].getValue();
197+
#else
195198
field[cellI] = state[cellI];
199+
#endif
196200
}
197201
}
198202
else if (fieldType == "volVectorField")
@@ -212,7 +216,11 @@ public:
212216
{
213217
for (label i = 0; i < 3; i++)
214218
{
215-
field[counterI] = state[cellI][i];
219+
#if defined(DAOF_AD_MODE_T1S) || defined(DAOF_AD_MODE_A1S)
220+
field[counterI] = state[cellI][i].getValue();
221+
#else
222+
field[counterI] = state[cellI][i];
223+
#endif
216224
counterI++;
217225
}
218226
}

‎src/setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
"-m64",
5353
"-pthread",
5454
"-DOPENFOAM=2112",
55-
"-DDAOF_AD_TOOL_DCO_FOAM",
55+
"-DDAOF_AD_TOOL_CODI"
56+
"-DDAOF_AD_MODE_A1S",
5657
#"-Dlinux64",
5758
#"-DWM_ARCH_OPTION=64",
5859
"-DWM_DP",

0 commit comments

Comments
 (0)
Please sign in to comment.