xref: /honee/src/smartsim_weak.c (revision 149fb5361f5198e41f87e8815a7e9dbfee84a96a)
1dc936754SJeremy L Thompson // Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors.
2aa0b7f76SJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3aa0b7f76SJames Wright //
4aa0b7f76SJames Wright // SPDX-License-Identifier: BSD-2-Clause
5aa0b7f76SJames Wright //
6aa0b7f76SJames Wright // This file is part of CEED:  http://github.com/ceed
7aa0b7f76SJames Wright //
8aa0b7f76SJames Wright // @file This creates weak functions for smartsim dependent functions. If the smartsim-dependent functions are actually built, these functions are not
9aa0b7f76SJames Wright // linked to the final executable.
10aa0b7f76SJames Wright 
11*149fb536SJames Wright #include <navierstokes.h>
12aa0b7f76SJames Wright 
13991aef52SJames Wright PetscErrorCode SGS_DD_TrainingSetup(Ceed ceed, User user, CeedData ceed_data, ProblemData problem) __attribute__((weak));
14991aef52SJames Wright PetscErrorCode SGS_DD_TrainingSetup(Ceed ceed, User user, CeedData ceed_data, ProblemData problem) {
15aa0b7f76SJames Wright   PetscFunctionBeginUser;
16aa0b7f76SJames Wright   SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_SUP, "Must build with SMARTREDIS_DIR set to run %s", __func__);
17aa0b7f76SJames Wright };
18aa0b7f76SJames Wright 
19aa0b7f76SJames Wright PetscErrorCode TSMonitor_SGS_DD_Training(TS ts, PetscInt step_num, PetscReal solution_time, Vec Q, void *ctx) __attribute__((weak));
20aa0b7f76SJames Wright PetscErrorCode TSMonitor_SGS_DD_Training(TS ts, PetscInt step_num, PetscReal solution_time, Vec Q, void *ctx) {
21aa0b7f76SJames Wright   PetscFunctionBeginUser;
22aa0b7f76SJames Wright   SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_SUP, "Must build with SMARTREDIS_DIR set to run %s", __func__);
23aa0b7f76SJames Wright };
24aa0b7f76SJames Wright 
25aa0b7f76SJames Wright PetscErrorCode SGS_DD_TrainingDataDestroy(SGS_DD_TrainingData sgs_dd_train) __attribute__((weak));
26aa0b7f76SJames Wright PetscErrorCode SGS_DD_TrainingDataDestroy(SGS_DD_TrainingData sgs_dd_train) {
27aa0b7f76SJames Wright   PetscFunctionBeginUser;
28aa0b7f76SJames Wright   if (!sgs_dd_train) PetscFunctionReturn(PETSC_SUCCESS);
29aa0b7f76SJames Wright   PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Warning: SGS_DD_TrainingData struct should not be initialized if SMARTREDIS_DIR isn't set on build..."));
30aa0b7f76SJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
31aa0b7f76SJames Wright }
32632a41e1SJames Wright 
33632a41e1SJames Wright PetscErrorCode TSPostStep_SGS_DD_Training(TS ts) __attribute__((weak));
34632a41e1SJames Wright PetscErrorCode TSPostStep_SGS_DD_Training(TS ts) {
35632a41e1SJames Wright   PetscFunctionBeginUser;
36632a41e1SJames Wright   SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_SUP, "Must build with SMARTREDIS_DIR set to run %s", __func__);
37632a41e1SJames Wright };
38ec6e4151SJames Wright 
39ec6e4151SJames Wright PetscErrorCode SmartSimDataDestroy(SmartSimData smartsim) __attribute__((weak));
40ec6e4151SJames Wright PetscErrorCode SmartSimDataDestroy(SmartSimData smartsim) {
41ec6e4151SJames Wright   PetscFunctionBeginUser;
42ec6e4151SJames Wright   if (!smartsim) PetscFunctionReturn(PETSC_SUCCESS);
43ec6e4151SJames Wright   PetscCall(PetscPrintf(PETSC_COMM_WORLD, "Warning: SmartSimData struct should not be initialized if SMARTREDIS_DIR isn't set on build..."));
44ec6e4151SJames Wright 
45ec6e4151SJames Wright   PetscFunctionReturn(PETSC_SUCCESS);
46ec6e4151SJames Wright }
47