xref: /honee/include/honee-file.h (revision 7e3656bdcd72727a42fa4cc010e63f36530a88f4)
1 // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors.
2 // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause
3 
4 #include <petscdm.h>
5 #include <petscdmplex.h>
6 #include <petscviewer.h>
7 
8 // Versioning token for binary checkpoints
9 extern const PetscInt32 HONEE_FILE_TOKEN;  // for backwards compatibility
10 extern const PetscInt32 HONEE_FILE_TOKEN_32;
11 extern const PetscInt32 HONEE_FILE_TOKEN_64;
12 
13 PetscErrorCode HoneeCheckFilenameExtension(MPI_Comm comm, const char filename[], const char extension[], PetscBool *is_extension);
14 
15 PetscErrorCode HoneeLoadInitialCondition(const char filename[], PetscInt *solution_steps, PetscReal *solution_time, Vec Q);
16 PetscErrorCode HoneeLoadBinaryVec(PetscViewer viewer, Vec Q, PetscReal *time, PetscInt *step_number);
17 PetscErrorCode HoneeWriteBinaryVec(PetscViewer viewer, Vec Q, PetscReal time, PetscInt step_number);
18 
19 PetscErrorCode PhastaDatFileOpen(const MPI_Comm comm, const char path[], const PetscInt char_array_len, PetscInt dims[2], FILE **fp);
20 PetscErrorCode PhastaDatFileGetNRows(const MPI_Comm comm, const char path[], PetscInt *nrows);
21 PetscErrorCode PhastaDatFileReadToArrayReal(const MPI_Comm comm, const char path[], PetscReal array[]);
22