Skip to content

Commit 2dce270

Browse files
authored
Merge pull request #60 from precice/PreCICE.jl-v3.0.1
Release v3.0.1
2 parents 0e6a0c4 + 62de105 commit 2dce270

5 files changed

Lines changed: 46 additions & 53 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PreCICE"
22
uuid = "57fbd4af-5cc3-4712-aac0-6930e7658184"
33
authors = ["preCICE <https://precice.org/> and contributors"]
4-
version = "3.0.0"
4+
version = "3.0.1"
55

66
[compat]
77
julia = "1.10"

src/PreCICE.jl

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export
4848
setMeshTetrahedron,
4949
setMeshTetrahedra,
5050
setMeshAccessRegion,
51-
getMeshVerticesAndIDs,
51+
getMeshVertexIDsAndCoordinates,
5252

5353
# data access
5454
writeData,
@@ -874,9 +874,7 @@ single mesh (from the other participant) is now involved in this situation since
874874
mesh defined by the participant itself is not required any more. In order to re-partition the
875875
received mesh, the participant needs to define the mesh region it wants read data from and
876876
write data to. The mesh region is specified through an axis-aligned bounding box given by the
877-
lower and upper [min and max] bounding-box limits in each space dimension [x, y, z]. This function is still
878-
experimental
879-
877+
lower and upper [min and max] bounding-box limits in each space dimension [x, y, z].
880878
881879
# Arguments
882880
- `meshName::String`: Name of the mesh to define the access region for.
@@ -904,8 +902,6 @@ the safety factor region resulting from the mapping. The default value of the sa
904902
enlarged.
905903
"""
906904
function setMeshAccessRegion(meshName::String, boundingBox::AbstractArray{Float64})
907-
@warn "The function setMeshAccessRegion is still experimental"
908-
909905
@assert length(boundingBox) > 0 "The bounding box must not be empty"
910906
@assert length(boundingBox) == getMeshDimensions(meshName) * 2 "The bounding box must have the same dimension as the mesh"
911907
ccall(
@@ -919,10 +915,10 @@ end
919915

920916
@doc """
921917
922-
getMeshVerticesAndIDs(meshName::String)::Tuple{AbstractArray{Integer}, AbstractArray{Float64}}
918+
getMeshVertexIDsAndCoordinates(meshName::String)::Tuple{AbstractArray{Integer}, AbstractArray{Float64}}
923919
924920
Iterating over the region of interest defined by bounding boxes and reading the corresponding
925-
coordinates omitting the mapping. This function is still experimental.
921+
coordinates omitting the mapping.
926922
927923
# Arguments
928924
- `meshName::String`: Name of the mesh to get the vertices and IDs for.
@@ -931,25 +927,22 @@ coordinates omitting the mapping. This function is still experimental.
931927
- `vertexIDs::AbstractArray{Integer}`: IDs of the vertices.
932928
- `vertexCoordinates::AbstractArray{Float64}`: Coordinates of the vertices and corresponding data values. Shape [N x D] where N = number of vertices and D = number of data dimensions.
933929
"""
934-
function getMeshVerticesAndIDs(
930+
function getMeshVertexIDsAndCoordinates(
935931
meshName::String,
936932
)::Tuple{AbstractArray{Integer},AbstractArray{Float64}}
937-
@warn "The function getMeshVerticesAndIDs is still experimental"
938-
939933
_size = getMeshVertexSize(meshName)
940934
vertexIDs = zeros(Cint, _size)
941935
vertexCoordinates = zeros(Float64, _size * getMeshDimensions(meshName))
942936
ccall(
943-
(:precicec_getMeshVerticesAndIDs, "libprecice"),
937+
(:precicec_getMeshVertexIDsAndCoordinates, "libprecice"),
944938
Cvoid,
945939
(Ptr{Int8}, Cint, Ref{Cint}, Ref{Cdouble}),
946940
meshName,
947941
_size,
948942
vertexIDs,
949943
vertexCoordinates,
950944
)
951-
return vertexIDs,
952-
permutedims(reshape(vertexCoordinates, (_size, getMeshDimensions(meshName))))
945+
return vertexIDs, reshape(vertexCoordinates, (_size, getMeshDimensions(meshName)))
953946
end
954947

955948
@doc """

test/DummyParticipant.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,15 @@ void precicec_setMeshAccessRegion(const char *meshName, const double *boundingBo
243243
}
244244
}
245245

246-
void precicec_getMeshVerticesAndIDs(const char *meshName, const int size, int *ids, double *coordinates)
246+
void precicec_getMeshVertexIDsAndCoordinates(const char *meshName, const int size, int *ids, double *coordinates)
247247
{
248248
assert(size == n_fake_vertices);
249249
assert(strcmp(meshName, "FakeMesh") == 0);
250250
for (int i = 0; i < size; i++)
251251
{
252252
ids[i] = fake_ids[i];
253-
coordinates[fake_mesh_dimensions * i] = i;
254-
coordinates[fake_mesh_dimensions * i + 1] = i + n_fake_vertices;
255-
coordinates[fake_mesh_dimensions * i + 2] = i + 2 * n_fake_vertices;
253+
coordinates[fake_mesh_dimensions * i] = fake_mesh_dimensions * i;
254+
coordinates[fake_mesh_dimensions * i + 1] = fake_mesh_dimensions * i + 1;
255+
coordinates[fake_mesh_dimensions * i + 2] = fake_mesh_dimensions * i + 2;
256256
}
257257
}

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ push!(Libc.Libdl.DL_LOAD_PATH, dirname(abspath(PROGRAM_FILE)))
4949
@test writeGradientData()
5050
@test getVersionInformation()
5151
@test setMeshAccessRegion()
52-
@test getMeshVerticesAndIDs()
52+
@test getMeshVertexIDsAndCoordinates()
5353
end #if
5454
end # testset
5555

test/test_functioncalls.jl

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ end
1313

1414
function getMeshDimensions()
1515
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
16-
fakeMeshDimension = 3 # compare to test/Participant.c, fake_dimensions
17-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
16+
fakeMeshDimension = 3 # compare to test/DummyParticipant.c, fake_dimensions
17+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
1818
return fakeMeshDimension == PreCICE.getMeshDimensions(fakeMeshName)
1919
end
2020

2121
function getDataDimensions()
2222
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
23-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
24-
fakeDataName = "FakeData" # compare to test/Participant.c, fake_data_name
25-
fakeDataDimension = 3 # compare to test/Participant.c, fake_dimensions
23+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
24+
fakeDataName = "FakeData" # compare to test/DummyParticipant.c, fake_data_name
25+
fakeDataDimension = 3 # compare to test/DummyParticipant.c, fake_dimensions
2626
return fakeDataDimension == PreCICE.getDataDimensions(fakeMeshName, fakeDataName)
2727
end
2828

@@ -58,27 +58,27 @@ end
5858

5959
function hasMesh()
6060
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
61-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
61+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
6262
return false == PreCICE.hasMesh(fakeMeshName)
6363
end
6464

6565
function hasData()
6666
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
67-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
68-
fakeDataName = "FakeData" # compare to test/Participant.c, fake_data_name
67+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
68+
fakeDataName = "FakeData" # compare to test/DummyParticipant.c, fake_data_name
6969
return false == PreCICE.hasData(fakeMeshName, fakeDataName)
7070
end
7171

7272
function requiresMeshConnectivityFor()
7373
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
74-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
74+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
7575
return false == PreCICE.requiresMeshConnectivityFor(fakeMeshName)
7676
end
7777

7878
function setMeshVertex()
7979
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
80-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
81-
fakeMeshDimension = 3 # compare to test/Participant.c, fake_dimensions
80+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
81+
fakeMeshDimension = 3 # compare to test/DummyParticipant.c, fake_dimensions
8282
fakePosition = rand(Cdouble, fakeMeshDimension)
8383
fakeVertexId = PreCICE.setMeshVertex(fakeMeshName, fakePosition)
8484
return 0 == fakeVertexId
@@ -87,9 +87,9 @@ end
8787

8888
function setMeshVertices()
8989
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
90-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
91-
fakeMeshDimension = 3 # compare to test/Participant.c, fake_dimensions
92-
nFakeVertices = 3 # compare to test/Participant.c, n_fake_vertices
90+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
91+
fakeMeshDimension = 3 # compare to test/DummyParticipant.c, fake_dimensions
92+
nFakeVertices = 3 # compare to test/DummyParticipant.c, n_fake_vertices
9393
positions = rand(Cdouble, (nFakeVertices, fakeMeshDimension))
9494
expectedOutput = 0:(nFakeVertices-1)
9595
actualOutput = PreCICE.setMeshVertices(fakeMeshName, positions)
@@ -98,9 +98,9 @@ end
9898

9999
# function setMeshVerticesEmpty()
100100
# PreCICE.createParticipant("test", "dummy.xml", 0, 1)
101-
# fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
102-
# fakeMeshDimension = 3 # compare to test/Participant.c, fake_dimensions
103-
# nFakeVertices = 0 # compare to test/Participant.c, n_fake_vertices
101+
# fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
102+
# fakeMeshDimension = 3 # compare to test/DummyParticipant.c, fake_dimensions
103+
# nFakeVertices = 0 # compare to test/DummyParticipant.c, n_fake_vertices
104104
# positions = rand(Cdouble, (nFakeVertices, fakeMeshDimension))
105105
# expectedOutput = []
106106
# actualOutput = PreCICE.setMeshVertices(fakeMeshName, positions)
@@ -109,8 +109,8 @@ end
109109

110110
function getMeshVertexSize()
111111
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
112-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
113-
nFakeVertices = 3 # compare to test/Participant.c, n_fake_vertices
112+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
113+
nFakeVertices = 3 # compare to test/DummyParticipant.c, n_fake_vertices
114114
nVertices = PreCICE.getMeshVertexSize(fakeMeshName)
115115
return nFakeVertices == nVertices
116116
end
@@ -126,8 +126,8 @@ end
126126

127127
function readWriteData()
128128
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
129-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
130-
fakeDataName = "FakeData" # compare to test/Participant.c, fake_data_name
129+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
130+
fakeDataName = "FakeData" # compare to test/DummyParticipant.c, fake_data_name
131131
writeData = [3.0 7.0 8.0; 7.0 6.0 5.0]
132132
PreCICE.writeData(fakeMeshName, fakeDataName, Cint[1, 2], writeData)
133133
readData = PreCICE.readData(fakeMeshName, fakeDataName, Cint[1, 2], 1.0)
@@ -144,16 +144,16 @@ end
144144

145145
function requiresGradientDataFor()
146146
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
147-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
148-
fakeDataName = "FakeData" # compare to test/Participant.c, fake_data_name
147+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
148+
fakeDataName = "FakeData" # compare to test/DummyParticipant.c, fake_data_name
149149
return false == PreCICE.requiresGradientDataFor(fakeMeshName, fakeDataName)
150150

151151
end
152152

153153
function writeGradientData()
154154
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
155-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
156-
fakeDataName = "FakeData" # compare to test/Participant.c, fake_data_name
155+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
156+
fakeDataName = "FakeData" # compare to test/DummyParticipant.c, fake_data_name
157157
nVertices = 2
158158
ndims = 3
159159
gradientData = rand(nVertices, ndims * ndims)
@@ -166,26 +166,26 @@ end
166166

167167
function getVersionInformation()
168168
versionInfo = PreCICE.getVersionInformation()
169-
fakeVersionInfo = "dummy" # compare to test/Participant.c
169+
fakeVersionInfo = "dummy" # compare to test/DummyParticipant.c
170170
return versionInfo == fakeVersionInfo
171171
end
172172

173173
function setMeshAccessRegion()
174174
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
175-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
175+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
176176
fakeBoundingBox = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
177177
PreCICE.setMeshAccessRegion(fakeMeshName, fakeBoundingBox)
178178
return true
179179
end
180180

181-
function getMeshVerticesAndIDs()
181+
function getMeshVertexIDsAndCoordinates()
182182
PreCICE.createParticipant("test", "dummy.xml", 0, 1)
183-
fakeMeshName = "FakeMesh" # compare to test/Participant.c, fake_mesh_name
184-
fakeMeshDimension = 3 # compare to test/Participant.c, fake_dimensions
185-
nFakeVertices = 3 # compare to test/Participant.c, fake_n_vertices
183+
fakeMeshName = "FakeMesh" # compare to test/DummyParticipant.c, fake_mesh_name
184+
fakeMeshDimension = 3 # compare to test/DummyParticipant.c, fake_dimensions
185+
nFakeVertices = 3 # compare to test/DummyParticipant.c, fake_n_vertices
186186
vertexIDs = Cint[0, 1, 2]
187187
expected_vertices =
188-
reshape(0:(nFakeVertices*fakeMeshDimension-1), (nFakeVertices, fakeMeshDimension))
189-
fakeIDs, fakeVertices = PreCICE.getMeshVerticesAndIDs(fakeMeshName)
188+
reshape(0.0:(nFakeVertices*fakeMeshDimension-1), (nFakeVertices, fakeMeshDimension))
189+
fakeIDs, fakeVertices = PreCICE.getMeshVertexIDsAndCoordinates(fakeMeshName)
190190
return fakeIDs == vertexIDs && fakeVertices == expected_vertices
191191
end

0 commit comments

Comments
 (0)