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