Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,28 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v2
- uses: actions/setup-python@v1
- name: Install OpenMPI, CMake, Boost library, Eigen and pkg-config
- name: Install OpenMPI, CMake, Boost library, Eigen, libxml2 and pkg-config
run: |
sudo apt-get -yy update
sudo apt-get install -y libopenmpi-dev cmake libboost-all-dev libeigen3-dev pkg-config
sudo apt-get install -y libopenmpi-dev cmake libboost-all-dev libeigen3-dev libxml2-dev pkg-config
sudo rm -rf /var/lib/apt/lists/*
- name: Checkout precice and make required files discoverable
- name: Checkout precice and build the universal mock
# TODO: switch back to --branch develop https://github.com/precice/precice.git
# once the universal mock (extras/mock) is merged upstream
run: |
git clone --branch develop https://github.com/precice/precice.git precice-core
mkdir -p precice
cp precice-core/src/precice/Participant.hpp precice/Participant.hpp
cp precice-core/src/precice/Tooling.hpp precice/Tooling.hpp
cp precice-core/src/precice/Tooling.cpp precice/Tooling.cpp
git clone --branch add-mocking-prototype https://github.com/JulianHarrison-Wirth/precice.git precice-core
cd precice-core
mkdir build && cd build
cmake .. -DPRECICE_FEATURE_MPI_COMMUNICATION=OFF -DPRECICE_FEATURE_PETSC_MAPPING=OFF -DPRECICE_FEATURE_PYTHON_ACTIONS=OFF -DBUILD_TESTING=OFF
cmake --build . --target preciceMocked -j 2
- name: Install tox
run: pip install tox
- name: Run tox
env:
PKG_CONFIG_SYSTEM_INCLUDE_PATH: 1
run: |
export PKG_CONFIG_PATH=$(readlink -f "precice-core/build")
export PRECICE_MOCK_LIB=$(readlink -f "precice-core/build/libpreciceMocked.so")
tox

build_dist:
Expand Down
5 changes: 2 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ include LICENSE.txt
include cyprecice/*.pyx
include cyprecice/*.pxd
include test/test_bindings_module.py
include test/Participant.cpp

# Include mocked interface file
include test/Participant.cpp
# Include configuration used by the tests together with the universal preCICE mock
include test/precice-config.xml
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ def get_extensions():
compile_args += cflags

if os.environ.get(MOCKED_ENV) is not None:
print(f"Building mocked pyprecice as {MOCKED_ENV} is set")
bindings_sources.append("test/Participant.cpp")
print(
f"Building pyprecice without linking libprecice as {MOCKED_ENV} is set.\n"
"The preCICE symbols have to be provided at runtime by preloading the "
"universal preCICE mock, e.g. LD_PRELOAD=/path/to/libpreciceMocked.so"
)
else:
link_args += ldflags

Expand Down
260 changes: 0 additions & 260 deletions test/Participant.cpp

This file was deleted.

57 changes: 57 additions & 0 deletions test/precice-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Configuration used by test_bindings_module.py together with the universal
preCICE mock (libpreciceMocked.so, see extras/mock in the preCICE repository).
The mock parses this file and validates all API calls against it. -->
<precice-configuration experimental="true" allow-remeshing="true">
<data:scalar name="FakeScalarData" />
<data:scalar name="FakeScalarReadData" />
<data:vector name="FakeVectorData" />
<data:vector name="FakeVectorReadData" />
<data:scalar name="JitWriteData" />
<data:scalar name="JitReadData" />

<mesh name="FakeMesh" dimensions="3">
<use-data name="FakeScalarData" />
<use-data name="FakeScalarReadData" />
<use-data name="FakeVectorData" />
<use-data name="FakeVectorReadData" />
</mesh>

<mesh name="PartnerMesh" dimensions="3">
<use-data name="JitWriteData" />
<use-data name="JitReadData" />
</mesh>

<participant name="test">
<provide-mesh name="FakeMesh" />
<receive-mesh name="PartnerMesh" from="partner" api-access="true" />
<write-data name="FakeScalarData" mesh="FakeMesh" />
<write-data name="FakeVectorData" mesh="FakeMesh" />
<read-data name="FakeScalarReadData" mesh="FakeMesh" />
<read-data name="FakeVectorReadData" mesh="FakeMesh" />
<write-data name="JitWriteData" mesh="PartnerMesh" />
<read-data name="JitReadData" mesh="PartnerMesh" />
<!-- just-in-time mappings for the direct-access mesh (no from/to attribute) -->
<mapping:nearest-neighbor direction="write" to="PartnerMesh" constraint="conservative" />
<mapping:nearest-neighbor direction="read" from="PartnerMesh" constraint="consistent" />
<!-- gradient mapping so that preCICE requires gradient data for write data on FakeMesh -->
<mapping:nearest-neighbor-gradient direction="write" from="FakeMesh" to="PartnerMesh" constraint="consistent" />
</participant>

<participant name="partner">
<receive-mesh name="FakeMesh" from="test" />
<provide-mesh name="PartnerMesh" />
<!-- projection-based mapping so that preCICE requires connectivity on FakeMesh -->
<mapping:nearest-projection direction="read" from="FakeMesh" to="PartnerMesh" constraint="consistent" />
</participant>

<m2n:sockets acceptor="test" connector="partner" exchange-directory=".." />

<coupling-scheme:serial-explicit>
<participants first="test" second="partner" />
<max-time-windows value="2" />
<time-window-size value="1.0" />
<exchange data="FakeScalarData" mesh="FakeMesh" from="test" to="partner" />
<exchange data="JitReadData" mesh="PartnerMesh" from="partner" to="test" />
</coupling-scheme:serial-explicit>
</precice-configuration>
Loading
Loading