Skip to content

Commit b659d14

Browse files
Fix the multipatch example with the new gsLookupfunction
1 parent 3a8e7f4 commit b659d14

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

examples/perpendicular-flap-multipatch-vertex-gismo.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ int main(int argc, char *argv[])
165165
}
166166
gsVector<index_t> quad_xyIDs; // needed for writing
167167
participant.addMesh(SolidMesh,quad_xy,quad_xyIDs);
168-
gsInfo << "Mesh added successfully\n";
169-
170-
gsDebugVar(quad_xy);
171-
gsDebugVar(quad_uv);
172168

173169
// Check if initial data is required (call before initialize)
174170
bool needsInitialData = participant.requiresInitialData();
@@ -199,8 +195,16 @@ int main(int argc, char *argv[])
199195
gsMatrix<> quad_stress(2,quad_xy.cols());
200196
quad_stress.setZero();
201197

202-
// Create lookup function with quad_xy points and quad_stress data
203-
gsLookupFunction<real_t> g_L(quad_xy, quad_stress);
198+
// Create lookup function with multiple patches
199+
gsLookupFunction<real_t> g_L(patches.nPatches());
200+
201+
// Add lookup function data for each patch separately
202+
for (size_t p = 0; p != patches.nPatches(); ++p)
203+
{
204+
// Get stress data for this patch
205+
gsMatrix<> patch_stress = quad_stress.block(0, patchOffsets[p], 2, patchQuad_xy[p].cols());
206+
g_L.add(patchQuad_xy[p], patch_stress);
207+
}
204208

205209
// gsPreCICEFunction<real_t> g_C(&participant,SolidMesh,StressData,patches,patches.geoDim(),false);
206210
// Add all BCs
@@ -372,7 +376,14 @@ int main(int argc, char *argv[])
372376
}
373377

374378
participant.readData(SolidMesh,StressData,quad_xyIDs,quad_stress);
375-
g_L.update();
379+
380+
// Update the lookup function with new stress data for each patch
381+
for (size_t p = 0; p != patches.nPatches(); ++p)
382+
{
383+
gsMatrix<> patch_stress = quad_stress.block(0, patchOffsets[p], 2, patchQuad_xy[p].cols());
384+
g_L.set(p, patchQuad_xy[p], patch_stress);
385+
}
386+
376387
// solve gismo timestep
377388
gsInfo << "Solving timestep " << time << "...\n";
378389
timeIntegrator->step(time,dt,U,V,A);

0 commit comments

Comments
 (0)