| misc.c (433eda4da4555c4a6e27c94cc36bce0197288780) | misc.c (013a555157cefb861605c4e4ea6ce4e03bb7c3d7) |
|---|---|
| 1// Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8/// @file --- 134 unchanged lines hidden (view full) --- 143 Vec Qref; 144 PetscViewer viewer; 145 PetscReal error, Qrefnorm; 146 MPI_Comm comm = PetscObjectComm((PetscObject)Q); 147 148 PetscFunctionBeginUser; 149 // Read reference file 150 PetscCall(VecDuplicate(Q, &Qref)); | 1// Copyright (c) 2017-2024, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8/// @file --- 134 unchanged lines hidden (view full) --- 143 Vec Qref; 144 PetscViewer viewer; 145 PetscReal error, Qrefnorm; 146 MPI_Comm comm = PetscObjectComm((PetscObject)Q); 147 148 PetscFunctionBeginUser; 149 // Read reference file 150 PetscCall(VecDuplicate(Q, &Qref)); |
| 151 PetscCheck(strcmp(app_ctx->test_file_path, "") != 0, comm, PETSC_ERR_FILE_READ, "File for regression test not given"); |
|
| 151 PetscCall(PetscViewerBinaryOpen(comm, app_ctx->test_file_path, FILE_MODE_READ, &viewer)); 152 PetscCall(LoadFluidsBinaryVec(comm, viewer, Qref, NULL, NULL)); 153 154 // Compute error with respect to reference solution 155 PetscCall(VecAXPY(Q, -1.0, Qref)); 156 PetscCall(VecNorm(Qref, NORM_MAX, &Qrefnorm)); 157 PetscCall(VecScale(Q, 1. / Qrefnorm)); 158 PetscCall(VecNorm(Q, NORM_MAX, &error)); --- 432 unchanged lines hidden --- | 152 PetscCall(PetscViewerBinaryOpen(comm, app_ctx->test_file_path, FILE_MODE_READ, &viewer)); 153 PetscCall(LoadFluidsBinaryVec(comm, viewer, Qref, NULL, NULL)); 154 155 // Compute error with respect to reference solution 156 PetscCall(VecAXPY(Q, -1.0, Qref)); 157 PetscCall(VecNorm(Qref, NORM_MAX, &Qrefnorm)); 158 PetscCall(VecScale(Q, 1. / Qrefnorm)); 159 PetscCall(VecNorm(Q, NORM_MAX, &error)); --- 432 unchanged lines hidden --- |