Skip to content

Conversation

@xuanweishan
Copy link

Goal

Solve issue #61 by adding a new option.

Edited files

src/configure.py

  • Add a new argument "--store_par_acc_snapshot".
  • Add a restriction for dependency between "--store_par_acc_snapshot" and "--store_par_acc".

doc/wiki/Installation-related/Installation\:-Option-List.md

  • Add the option description to option list.

doc/wiki/Physics-Modules-related/Particles.md

  • Add a link to option wiki "--store_par_acc_snapshot"

@hyschive
Copy link
Contributor

@xuanweishan Instead of introducing a new compilation option, I'd prefer to have this feature implemented as a runtime option, similar to the existing OPT__OUTPUT_* options.

@hyschive hyschive marked this pull request as draft November 15, 2025 14:46
@xuanweishan
Copy link
Author

xuanweishan commented Dec 10, 2025

Changes

New edition is ready for review. New changes are shown below:

  1. Create new runtime parameter OPT__OUTPUT_PAR_ADDI_ATTR
  2. Create restriction check in /src/Auxiliary/Aux_Check_Parameter.cpp
  3. Update wiki and Input__Parameter for new parameter.
  4. Edit function Output_DumpData_Total and Output_DumpData_Total_HDF5 for the control of storing additional attribute.

Edited files

doc/wiki/Runtime-Parameters-related/Runtime-Parameters:-Outputs.md

Update the description and restriction to the page.

example/test_problem/Template/Input__Parameter

Add new parameter and related description to template file.

include/Global.h src/Main/Main.cpp src/Init/Init_Load_Parameter.cpp

Define new runtime parameter and parameter loading function

src/Auxiliary/Aux_Check_Parameter.cpp src/Auxiliary/Aux_TakeNote.cpp

Add the lines for checking parameter restriction and record the setting in Record__Note

src/Output/Output_DumpData_Total.cpp

By adding a new variable par_natt_flt_addi that define the number of column we need for additional attributes.

   int par_natt_flt_addi = 0;
   switch ( OPT__OUTPUT_PAR_ADDI_ATTR )
   {
      case 0:  break;
      case 1:  par_natt_flt_addi = 1; break;
      case 2:  par_natt_flt_addi = 3; break;
      case 3:  par_natt_flt_addi = 4; break;
      default: break;
   }

And expand the dump data loop and check if we need to move the column index(v) to proper value

   const int  par_natt_flt_stored = PAR_NATT_FLT_STORED + par_natt_flt_addi;
   ...
   for (int v=0; v<par_natt_flt_stored; v++)
   ...
         if ( v > PAR_NATT_FLT_STORED )
         switch ( OPT__OUTPUT_PAR_ADDI_ATTR )
         {
            case 1:  v = PAR_TIME; break;
            default: break;
         } // if ( v > PAR_NATT_FLT_STORED ), switch OPT__OUTPUT_PAR_ADDI_ATTR
   ...

src/Output/Output_DumpData_Total_HDF5.cpp

Same concept is applied in this file to store additional attributes. But applied on both column name and particle data storing.

Tests

  • ParticleTest w/o setting OPT__OUTPUT_PAR_ADDI_ATTR(default 0, off)
  • ParticleTest w/ setting OPT__OUTPUT_PAR_ADDI_ATTR as 1, 2 and 3.
  • ParticleTest w/ setting OPT__OUTPUT_PAR_ADDI_ATTR as 4. (invalid value).
  • ParticleTest w/ compile gamer without store_par_acc & setting OPT__OUTPUT_PAR_ADDI_ATTR as 1, 2 and 3.(Error reported)

@xuanweishan xuanweishan marked this pull request as ready for review December 11, 2025 04:57
@hyschive hyschive requested a review from hfhsieh January 8, 2026 02:09
@hyschive hyschive added enhancement output Data output and log labels Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement output Data output and log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants