xref: /honee/src/smartsim_weak.c (revision ae2b091fac884a554e48acc4b4c187524c2a2818)
1*ae2b091fSJames Wright // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2*ae2b091fSJames Wright // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3aa0b7f76SJames Wright //
4aa0b7f76SJames Wright // @file This creates weak functions for smartsim dependent functions. If the smartsim-dependent functions are actually built, these functions are not
5aa0b7f76SJames Wright // linked to the final executable.
6aa0b7f76SJames Wright 
7149fb536SJames Wright #include <navierstokes.h>
8aa0b7f76SJames Wright 
9991aef52SJames Wright PetscErrorCode SGS_DD_TrainingSetup(Ceed ceed, User user, CeedData ceed_data, ProblemData problem) __attribute__((weak));
10991aef52SJames Wright PetscErrorCode SGS_DD_TrainingSetup(Ceed ceed, User user, CeedData ceed_data, ProblemData problem) {
11aa0b7f76SJames Wright   PetscFunctionBeginUser;
12aa0b7f76SJames Wright   SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_SUP, "Must build with SMARTREDIS_DIR set to run %s", __func__);
13aa0b7f76SJames Wright };
14aa0b7f76SJames Wright 
15aa0b7f76SJames Wright PetscErrorCode TSMonitor_SGS_DD_Training(TS ts, PetscInt step_num, PetscReal solution_time, Vec Q, void *ctx) __attribute__((weak));
16aa0b7f76SJames Wright PetscErrorCode TSMonitor_SGS_DD_Training(TS ts, PetscInt step_num, PetscReal solution_time, Vec Q, void *ctx) {
17aa0b7f76SJames Wright   PetscFunctionBeginUser;
18aa0b7f76SJames Wright   SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_SUP, "Must build with SMARTREDIS_DIR set to run %s", __func__);
19aa0b7f76SJames Wright };
20aa0b7f76SJames Wright 
21aa0b7f76SJames Wright PetscErrorCode SGS_DD_TrainingDataDestroy(SGS_DD_TrainingData sgs_dd_train) __attribute__((weak));
22aa0b7f76SJames Wright PetscErrorCode SGS_DD_TrainingDataDestroy(SGS_DD_TrainingData sgs_dd_train) {
23aa0b7f76SJames Wright   PetscFunctionBeginUser;
24aa0b7f76SJames Wright   if (!sgs_dd_train) PetscFunctionReturn(PETSC_SUCCESS);
25aa0b7f76SJames Wright   PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Warning: SGS_DD_TrainingData struct should not be initialized if SMARTREDIS_DIR isn't set on build..."));
26aa0b7f76SJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
27aa0b7f76SJames Wright }
28632a41e1SJames Wright 
29632a41e1SJames Wright PetscErrorCode TSPostStep_SGS_DD_Training(TS ts) __attribute__((weak));
30632a41e1SJames Wright PetscErrorCode TSPostStep_SGS_DD_Training(TS ts) {
31632a41e1SJames Wright   PetscFunctionBeginUser;
32632a41e1SJames Wright   SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_SUP, "Must build with SMARTREDIS_DIR set to run %s", __func__);
33632a41e1SJames Wright };
34ec6e4151SJames Wright 
35ec6e4151SJames Wright PetscErrorCode SmartSimDataDestroy(SmartSimData smartsim) __attribute__((weak));
36ec6e4151SJames Wright PetscErrorCode SmartSimDataDestroy(SmartSimData smartsim) {
37ec6e4151SJames Wright   PetscFunctionBeginUser;
38ec6e4151SJames Wright   if (!smartsim) PetscFunctionReturn(PETSC_SUCCESS);
39ec6e4151SJames Wright   PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Warning: SmartSimData struct should not be initialized if SMARTREDIS_DIR isn't set on build..."));
40ec6e4151SJames Wright 
41ec6e4151SJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
42ec6e4151SJames Wright }
43