Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn on use of default parameters #250

Merged
merged 7 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions perl/Galacticus/Build/SourceTree/Process/FunctionClass.pm
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ CODE
$rankMaximum = $rank
if ( $rank > $rankMaximum );
}
foreach my $variableName ( @{$declaration->{'variables'}} ) {
foreach my $variableName ( @{$declaration->{'variableNames'}} ) {
$assignments .= "if (allocated(self%".$variableName.")) then\n"
if ( grep {$_ eq "allocatable"} @{$declaration->{'attributes'}} );
for(my $i=1;$i<=$rank;++$i) {
Expand Down Expand Up @@ -1239,7 +1239,7 @@ CODE
$rankMaximum = $rank
if ( $rank > $rankMaximum );
}
foreach my $variableName ( @{$declaration->{'variables'}} ) {
foreach my $variableName ( @{$declaration->{'variableNames'}} ) {
for(my $i=1;$i<=$rank;++$i) {
$assignments .= (" " x $i)."do i".$i."=lbound(self%".$variableName.",dim=".$i."),ubound(self%".$variableName.",dim=".$i.")\n";
}
Expand Down
21 changes: 14 additions & 7 deletions perl/Galacticus/Build/SourceTree/Process/ObjectBuilder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ sub Process_ObjectBuilder {
$builderCode .= " call ".$node->{'directive'}->{'name'}."%autoHook()\n";
$builderCode .= $debugMessage;
$builderCode .= $copyLoopClose;
$builderCode .= " call Warn('Using default class for parameter ''['//char(parametersCurrent%path())//'".$parameterName."]''')\n";
$builderCode .= " end if\n";
}
if ( exists($node->{'directive'}->{'parameterName'}) ) {
Expand Down Expand Up @@ -220,19 +221,25 @@ sub Process_ObjectBuilder {
type => "moduleUse",
moduleUse =>
{
"Input_Parameters" =>
"Input_Parameters" =>
{
intrinsic => 0,
only => {inputParameter => 1}
},
"Error" =>
{
intrinsic => 0,
only => {Warn => 1}
},
"ISO_Varying_String" =>
{
intrinsic => 0,
only => {char => 1}
}
}
};
$usesNode->{'moduleUse'}->{'ISO_Varying_String'} =
{
intrinsic => 0,
only => {var_str => 1}
}
if ( $parametersDefaultRequired );
$usesNode->{'moduleUse'}->{'ISO_Varying_String'}->{'only'}->{'var_str'} = 1
if ( $parametersDefaultRequired );
$usesNode->{'moduleUse'}->{$moduleName} =
{
intrinsic => 0,
Expand Down
22 changes: 11 additions & 11 deletions source/merger_trees.operators.particulate.F90
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,23 @@ function particulateConstructorParameters(parameters) result(self)
type (inputParameters ), intent(inout) :: parameters
type (varying_string ) :: outputFileName
integer (kind_int8 ) :: idMultiplier
double precision :: massParticle , radiusTruncateOverRadiusVirial , &
& timeSnapshot , energyDistributionPointsPerDecade, &
& lengthSoftening , toleranceRelativeSmoothing , &
double precision :: massParticle , radiusTruncateOverRadiusVirial , &
& timeSnapshot , energyDistributionPointsPerDecade, &
& lengthSoftening , toleranceRelativeSmoothing , &
& toleranceMass
logical :: satelliteOffset , nonCosmological , &
& positionOffset , addHubbleFlow , &
& haloIdToParticleType , sampleParticleNumber , &
logical :: satelliteOffset , nonCosmological , &
& positionOffset , addHubbleFlow , &
& haloIdToParticleType , sampleParticleNumber , &
& subtractRandomOffset
integer :: selection , chunkSize , &
integer :: selection , chunkSize , &
& kernelSoftening
class (cosmologyParametersClass ), pointer :: cosmologyParameters_
class (cosmologyFunctionsClass ), pointer :: cosmologyFunctions_
class (darkMatterHaloScaleClass ), pointer :: darkMatterHaloScale_
class (darkMatterProfileDMOClass ), pointer :: darkMatterProfileDMO_
class (galacticStructureClass ), pointer :: galacticStructure_
type (inputParameters ), pointer :: parametersRoot
type (varying_string ) :: selectionText , kernelSofteningText
type (inputParameters ), pointer :: parametersRoot => null()
type (varying_string ) :: selectionText , kernelSofteningText

!![
<inputParameter>
Expand Down Expand Up @@ -521,8 +521,8 @@ subroutine particulateOperatePreEvolution(self,tree)
!$omp do reduction(+: positionRandomOffset, velocityRandomOffset)
do i=1,particleCountActual
!$ if (OMP_Get_Thread_Num() == 0) then
call displayCounter(max(1,int(100.0d0*dble(counter)/dble(particleCountActual))),isNew=isNew,verbosity=verbosityLevelStandard)
isNew=.false.
call displayCounter(max(1,int(100.0d0*dble(counter)/dble(particleCountActual))),isNew=isNew,verbosity=verbosityLevelStandard)
isNew=.false.
!$ end if
!$omp atomic
counter=counter+1
Expand Down
Loading