|
PICurv 0.1.0
A Parallel Particle-In-Cell Solver for Curvilinear LES
|
C unit tests for runtime log-level, allow-list, conversion, and profiling helpers. More...
#include "test_support.h"#include "logging.h"#include "interpolation.h"#include "setup.h"#include <fcntl.h>#include <math.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>Go to the source code of this file.
Data Structures | |
| struct | AnatomyCaptureCtx |
Typedefs | |
| typedef PetscErrorCode(* | CapturedLoggingFn) (UserCtx *user, SimCtx *simCtx, void *ctx) |
| typedef struct AnatomyCaptureCtx | AnatomyCaptureCtx |
Functions | |
| static PetscErrorCode | AssertFileContains (const char *path, const char *needle, const char *context) |
| Asserts that one text file contains a required substring. | |
| static PetscErrorCode | AssertFileNotContains (const char *path, const char *needle, const char *context) |
| Asserts that one text file does not contain an excluded substring. | |
| static PetscErrorCode | ReadCsvHeaderAndRow (const char *path, PetscInt row_index, char *header, size_t header_len, char *row, size_t row_len) |
| Reads the CSV header and the requested 1-based data row from a text file. | |
| static PetscErrorCode | CsvFindColumnIndex (const char *header, const char *column_name, PetscInt *index_out) |
| Returns the zero-based column index for one CSV header field. | |
| static PetscErrorCode | CsvGetColumnText (const char *header, const char *row, const char *column_name, char *value, size_t value_len) |
| Extracts one CSV cell as text by header name. | |
| static PetscErrorCode | CsvGetColumnInt (const char *header, const char *row, const char *column_name, PetscInt *value_out) |
| Extracts one CSV cell as an integer by header name. | |
| static PetscErrorCode | CsvGetColumnReal (const char *header, const char *row, const char *column_name, PetscReal *value_out) |
| Extracts one CSV cell as a real by header name. | |
| static PetscErrorCode | ReadLogHeaderAndRow (const char *path, PetscInt row_index, char *header, size_t header_len, char *row, size_t row_len) |
| Reads the column header and the requested 1-based data row from a pipe-delimited solution-convergence log file. | |
| static PetscErrorCode | LogFindColumnIndex (const char *header, const char *column_name, PetscInt *index_out) |
| Returns the zero-based column index for one pipe-delimited header field. | |
| static PetscErrorCode | LogGetColumnText (const char *header, const char *row, const char *column_name, char *value, size_t value_len) |
| Extracts one pipe-delimited log cell as text by header name. | |
| static PetscErrorCode | LogGetColumnInt (const char *header, const char *row, const char *column_name, PetscInt *value_out) |
| Extracts one pipe-delimited log cell as an integer by header name. | |
| static PetscErrorCode | LogGetColumnReal (const char *header, const char *row, const char *column_name, PetscReal *value_out) |
| Extracts one pipe-delimited log cell as a real by header name. | |
| static PetscErrorCode | CaptureLoggingOutput (UserCtx *user, SimCtx *simCtx, CapturedLoggingFn fn, void *ctx, char *captured, size_t captured_len) |
| Captures stdout emitted by one logging helper into a temporary file-backed buffer. | |
| static PetscErrorCode | InvokeParticleFieldLog (UserCtx *user, SimCtx *simCtx, void *ctx) |
Adapts LOG_PARTICLE_FIELDS() to the generic stdout-capture callback shape. | |
| static PetscErrorCode | InvokeParticleConsoleSnapshot (UserCtx *user, SimCtx *simCtx, void *ctx) |
Adapts EmitParticleConsoleSnapshot() to the generic stdout-capture callback shape. | |
| static PetscErrorCode | InvokeFieldAnatomyLog (UserCtx *user, SimCtx *simCtx, void *ctx) |
Adapts LOG_FIELD_ANATOMY() to the generic stdout-capture callback shape. | |
| static PetscErrorCode | SeedLoggingParticleFixture (SimCtx **simCtx_out, UserCtx **user_out) |
| Creates a small particle-bearing runtime fixture used by logging tests. | |
| static PetscErrorCode | SetUniformVelocityField (UserCtx *user, Vec field, PetscReal ux, PetscReal uy, PetscReal uz) |
| Fills one Cartesian velocity field with a uniform constant state. | |
| static PetscErrorCode | SetUniformScalarField (UserCtx *user, Vec field, PetscReal value) |
| Fills one scalar field with a uniform constant state. | |
| static PetscErrorCode | TestStringConversionHelpers (void) |
| Tests string-conversion helpers for configured enums and unknown values. | |
| static PetscErrorCode | TestGetLogLevelFromEnvironment (void) |
| Tests that log level selection honors the environment variable. | |
| static PetscErrorCode | TestAllowedFunctionsFilter (void) |
| Tests the function allow-list filter used by the logging layer. | |
| static PetscErrorCode | TestParticleConsoleSnapshotCadence (void) |
| Tests periodic particle console snapshot enablement and cadence. | |
| static PetscErrorCode | TestLoggingFileParsingAndFormattingHelpers (void) |
| Tests logging-side file parsing, helper formatting, and progress utilities. | |
| static PetscErrorCode | TestLoggingContinuityAndFieldDiagnostics (void) |
| Tests continuity, min/max, and anatomy logging helpers on minimal runtime fixtures. | |
| static PetscErrorCode | TestInterpolationErrorLogging (void) |
| Tests interpolation-error logging against an analytically matched particle field. | |
| static PetscErrorCode | TestScatterMetricsLogging (void) |
| Tests file-backed scatter metrics logging against a fully occupied constant field. | |
| static PetscErrorCode | TestParticleFieldTableLogging (void) |
| Tests stdout particle-table logging on a production-like swarm fixture. | |
| static PetscErrorCode | TestParticleConsoleSnapshotLogging (void) |
| Tests console snapshot logging against the public periodic-snapshot helper. | |
| static PetscErrorCode | TestParticleMetricsLogging (void) |
| Tests file-backed particle metrics logging after derived metrics are computed. | |
| static PetscErrorCode | TestSearchMetricsLogging (void) |
| Tests file-backed search metrics logging with the compact CSV contract. | |
| static PetscErrorCode | TestFieldAnatomyLogging (void) |
| Tests stdout field-anatomy logging on the corrected production-like DM fixture. | |
| static PetscErrorCode | TestProfilingLifecycleHelpers (void) |
| Tests profiling helper lifecycle logging for timestep and final-summary outputs. | |
| static PetscErrorCode | TestRuntimeMemoryLogHelpers (void) |
| Tests runtime memory log header, step rows, final rows, and disabled mode. | |
| static PetscErrorCode | TestSolutionConvergenceSteadyLogging (void) |
| Tests steady solution-convergence log output, IBM masking, and gauge-invariant pressure drift. | |
| static PetscErrorCode | TestSolutionConvergencePeriodicLogging (void) |
| Tests periodic solution-convergence warmup and phase-aligned reference reuse. | |
| static PetscErrorCode | TestSolutionConvergenceStatisticalLogging (void) |
| Tests statistical solution-convergence sliding-window metrics. | |
| int | main (int argc, char **argv) |
| Runs the unit-logging PETSc test binary. | |
C unit tests for runtime log-level, allow-list, conversion, and profiling helpers.
Definition in file test_logging.c.
| struct AnatomyCaptureCtx |
Definition at line 403 of file test_logging.c.
| Data Fields | ||
|---|---|---|
| const char * | field_name | |
| const char * | stage_name | |
Definition at line 401 of file test_logging.c.
| typedef struct AnatomyCaptureCtx AnatomyCaptureCtx |
|
static |
Asserts that one text file contains a required substring.
Definition at line 22 of file test_logging.c.
|
static |
Asserts that one text file does not contain an excluded substring.
Definition at line 67 of file test_logging.c.
|
static |
Reads the CSV header and the requested 1-based data row from a text file.
Definition at line 112 of file test_logging.c.
|
static |
Returns the zero-based column index for one CSV header field.
Definition at line 147 of file test_logging.c.
|
static |
Extracts one CSV cell as text by header name.
Definition at line 177 of file test_logging.c.
|
static |
Extracts one CSV cell as an integer by header name.
Definition at line 213 of file test_logging.c.
|
static |
Extracts one CSV cell as a real by header name.
Definition at line 231 of file test_logging.c.
|
static |
Reads the column header and the requested 1-based data row from a pipe-delimited solution-convergence log file.
Lines starting with '=' (banner) or '-' (separator) are skipped. The first non-skipped line is treated as the column header; subsequent non-skipped lines are data rows numbered from 1.
Definition at line 254 of file test_logging.c.
|
static |
Returns the zero-based column index for one pipe-delimited header field.
Definition at line 298 of file test_logging.c.
|
static |
Extracts one pipe-delimited log cell as text by header name.
Definition at line 330 of file test_logging.c.
|
static |
Extracts one pipe-delimited log cell as an integer by header name.
Definition at line 368 of file test_logging.c.
|
static |
Extracts one pipe-delimited log cell as a real by header name.
Definition at line 386 of file test_logging.c.
|
static |
Captures stdout emitted by one logging helper into a temporary file-backed buffer.
Definition at line 411 of file test_logging.c.
Adapts LOG_PARTICLE_FIELDS() to the generic stdout-capture callback shape.
Definition at line 462 of file test_logging.c.
|
static |
Adapts EmitParticleConsoleSnapshot() to the generic stdout-capture callback shape.
Definition at line 475 of file test_logging.c.
Adapts LOG_FIELD_ANATOMY() to the generic stdout-capture callback shape.
Definition at line 487 of file test_logging.c.
|
static |
Creates a small particle-bearing runtime fixture used by logging tests.
Definition at line 500 of file test_logging.c.
|
static |
Fills one Cartesian velocity field with a uniform constant state.
Definition at line 548 of file test_logging.c.
|
static |
Fills one scalar field with a uniform constant state.
Definition at line 573 of file test_logging.c.
|
static |
Tests string-conversion helpers for configured enums and unknown values.
Definition at line 596 of file test_logging.c.
|
static |
Tests that log level selection honors the environment variable.
Definition at line 623 of file test_logging.c.
|
static |
Tests the function allow-list filter used by the logging layer.
Definition at line 635 of file test_logging.c.
|
static |
Tests periodic particle console snapshot enablement and cadence.
Definition at line 655 of file test_logging.c.
|
static |
Tests logging-side file parsing, helper formatting, and progress utilities.
Definition at line 682 of file test_logging.c.
|
static |
Tests continuity, min/max, and anatomy logging helpers on minimal runtime fixtures.
Definition at line 747 of file test_logging.c.
|
static |
Tests interpolation-error logging against an analytically matched particle field.
Definition at line 834 of file test_logging.c.
|
static |
Tests file-backed scatter metrics logging against a fully occupied constant field.
Definition at line 881 of file test_logging.c.
|
static |
Tests stdout particle-table logging on a production-like swarm fixture.
Definition at line 955 of file test_logging.c.
|
static |
Tests console snapshot logging against the public periodic-snapshot helper.
Definition at line 976 of file test_logging.c.
|
static |
Tests file-backed particle metrics logging after derived metrics are computed.
Definition at line 997 of file test_logging.c.
|
static |
Tests file-backed search metrics logging with the compact CSV contract.
Definition at line 1033 of file test_logging.c.
|
static |
Tests stdout field-anatomy logging on the corrected production-like DM fixture.
Definition at line 1084 of file test_logging.c.
|
static |
Tests profiling helper lifecycle logging for timestep and final-summary outputs.
Definition at line 1108 of file test_logging.c.
|
static |
Tests runtime memory log header, step rows, final rows, and disabled mode.
Definition at line 1167 of file test_logging.c.
|
static |
Tests steady solution-convergence log output, IBM masking, and gauge-invariant pressure drift.
Definition at line 1212 of file test_logging.c.
|
static |
Tests periodic solution-convergence warmup and phase-aligned reference reuse.
Definition at line 1297 of file test_logging.c.
|
static |
Tests statistical solution-convergence sliding-window metrics.
Definition at line 1382 of file test_logging.c.
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Runs the unit-logging PETSc test binary.
Definition at line 1456 of file test_logging.c.