Skip to content

Commit

Permalink
Merge pull request #6062 from gassmoeller/apply_update_script
Browse files Browse the repository at this point in the history
Apply update script to header, source and prm files.
  • Loading branch information
tjhei authored Oct 11, 2024
2 parents bb42d81 + 4efa529 commit 6e2d242
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 23 deletions.
6 changes: 3 additions & 3 deletions contrib/utilities/update_all_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ BASE_DIR=`cd ${UTIL_DIR}/../..;pwd`
echo "Scanning ${BASE_DIR} for changes..."

# Update source files
SOURCE_FILES=`find $BASE_DIR -type f \( -name *.cc -or -name *.h \) -and -not -name *.bak | grep -v doc`
SOURCE_FILES=`find $BASE_DIR -type f \( -name \*.cc -or -name \*.h \) -and -not -name \*.bak | grep -v doc`
bash ${UTIL_DIR}/update_source_files.sh $SOURCE_FILES

# Update prm files
PRM_FILES=`find $BASE_DIR -type f -name *.prm* -not -name *update_script* -not -name *prmbackslash_2.prm -not -name *.bak`
PRM_FILES=`find $BASE_DIR -type f -name \*.prm\* -and -not \( -name \*update_script\*.prm -or -name \*prmbackslash_2.prm -or -name \*.bak \)`
bash ${UTIL_DIR}/update_prm_files.sh $PRM_FILES

# To remove the backup files that are created you will likely want to use the
# following command. It is commented out by default, because you should think
# carefully before automatically removing files.
#find ${BASE_DIR} -name *.bak -delete
#find ${BASE_DIR} -name \*.bak -delete
11 changes: 5 additions & 6 deletions contrib/utilities/update_prm_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,19 @@ done
# remove the backup file. We can not use this file
# instead of the .bak file, because it is overwritten by every script,
# and so it is only a backup of the last execution.
for script in `find ${SCRIPT_FOLDER} -maxdepth 1 -name *.sed`; do
for script in `find ${SCRIPT_FOLDER} -maxdepth 1 -name \*.sed`; do
sed -i.tmp -f $script "$@"
done

for script in `find ${SCRIPT_FOLDER} -maxdepth 1 -name *.pl`; do
for file in $@ ; do
for script in `find ${SCRIPT_FOLDER} -maxdepth 1 -name \*.pl`; do
for file in "$@" ; do
cat "$file" | perl $script > "$file.tmp"
mv "$file.tmp" "$file"
done
done

for script in `find ${SCRIPT_FOLDER} -maxdepth 1 -name *.py`; do
for file in $@ ; do
echo $file
for script in `find ${SCRIPT_FOLDER} -maxdepth 1 -name \*.py`; do
for file in "$@" ; do
python3 $script $file "$file.tmp"
mv "$file.tmp" "$file"
done
Expand Down
4 changes: 2 additions & 2 deletions contrib/utilities/update_source_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ done
# remove the backup file. We can not use this file
# instead of the .bak file, because it is overwritten by every script,
# and so it is only a backup of the last execution.
for script in `find ${SCRIPT_FOLDER} -maxdepth 1 -name *.sed`; do
for script in `find ${SCRIPT_FOLDER} -maxdepth 1 -name \*.sed`; do
sed -i.tmp -f $script "$@"
done

for script in `find ${SCRIPT_FOLDER} -maxdepth 1 -name *.pl`; do
for script in `find ${SCRIPT_FOLDER} -maxdepth 1 -name \*.pl`; do
for file in $@ ; do
cat "$file" | perl $script > "$file.tmp"
mv "$file.tmp" "$file"
Expand Down
2 changes: 1 addition & 1 deletion source/postprocess/particles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ namespace aspect
}

if (write_output == false)
return std::make_pair("Number of advected particles", number_of_advected_particles);
return std::make_pair("Number of advected particles:", number_of_advected_particles);

if (output_file_number == numbers::invalid_unsigned_int)
output_file_number = 0;
Expand Down
1 change: 1 addition & 0 deletions tests/darcy_convection_step.prm
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ end
# Output the darcy velocity
subsection Postprocess
set List of postprocessors = visualization

subsection Visualization
set List of output variables = darcy velocity
set Output format = gnuplot
Expand Down
1 change: 0 additions & 1 deletion tests/nonlinear_failure_strategy_abort.prm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ include $ASPECT_SOURCE_DIR/tests/iterated_advection_and_stokes_residual.prm

set Nonlinear solver failure strategy = abort program
set Max nonlinear iterations = 4

set Dimension = 2
set End time = 20000
1 change: 0 additions & 1 deletion tests/nonlinear_failure_strategy_cut.prm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ include $ASPECT_SOURCE_DIR/tests/iterated_advection_and_stokes_residual.prm

set Nonlinear solver failure strategy = cut timestep size
set Max nonlinear iterations = 4

set Dimension = 2
set End time = 20000
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set Dimension = 2

include $ASPECT_SOURCE_DIR/tests/particle_interpolator_distance_weighted_average.prm


subsection Mesh refinement
set Initial adaptive refinement = 2
set Strategy = composition
Expand Down
1 change: 0 additions & 1 deletion tests/particle_multiple_worlds_interpolation_fail_1.prm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ subsection Compositional fields
set Names of fields = anomaly, function
set Compositional field methods = particles, particles
set Mapped particle properties = anomaly: function, function: initial anomaly

end

subsection Initial composition model
Expand Down
1 change: 0 additions & 1 deletion tests/particle_multiple_worlds_interpolation_fail_2.prm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ subsection Compositional fields
set Names of fields = anomaly, function
set Compositional field methods = particles, particles
set Mapped particle properties = anomaly: function, function: initial anomaly

end

subsection Initial composition model
Expand Down
2 changes: 0 additions & 2 deletions tests/update_script/screen-output
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Loading shared library <./libupdate_script.debug.so>
Executing the update script:
cp update_script.x.prm output-update_script/updated.prm &&sed -i.bak 's:set Additional shared libraries = ./libupdate_script.so::' output-update_script/updated.prm &&bash ASPECT_DIR/contrib/utilities/update_prm_files.sh output-update_script/updated.prm &&rm output-update_script/updated.prm.bak
output-update_script/updated.prm
output-update_script/updated.prm
Running ASPECT with updated parameter file:
../aspect output-update_script/updated.prm

Expand Down
4 changes: 0 additions & 4 deletions tests/update_script_2/screen-output
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
Loading shared library <./libupdate_script_2.debug.so>
Executing the update script:
cp update_script_2.x.prm output-update_script_2/updated2.prm;sed -i.bak 's:set Additional shared libraries = ./libupdate_script_2.so::' output-update_script_2/updated2.prm;bash ASPECT_DIR/contrib/utilities/update_prm_files.sh output-update_script_2/updated2.prm;bash ASPECT_DIR/contrib/utilities/update_prm_files.sh output-update_script_2/updated2.prm;rm output-update_script_2/updated2.prm.bak
output-update_script_2/updated2.prm
output-update_script_2/updated2.prm
output-update_script_2/updated2.prm
output-update_script_2/updated2.prm
Running ASPECT with updated parameter file:
../aspect output-update_script_2/updated2.prm

Expand Down
1 change: 0 additions & 1 deletion tests/visco_plastic_adiabatic_pressure_in_plasticity.prm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ subsection Material model
subsection Visco Plastic
set Reference strain rate = 1.e-16
set Viscous flow law = composite

set Use adiabatic pressure in plasticity = true
set Angles of internal friction = 10
set Cohesions = 1e6
Expand Down

0 comments on commit 6e2d242

Please sign in to comment.