From 315615fbcf9b1bb9c12408cba1b5a8e2cc3c94c5 Mon Sep 17 00:00:00 2001 From: Andrew Benson Date: Tue, 29 Oct 2024 07:39:51 -0700 Subject: [PATCH] fix: Minor style changes --- ...ger_trees.build.controller.main_branch.F90 | 57 +++++++++++-------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/source/merger_trees.build.controller.main_branch.F90 b/source/merger_trees.build.controller.main_branch.F90 index 1133b1219..2369d5215 100644 --- a/source/merger_trees.build.controller.main_branch.F90 +++ b/source/merger_trees.build.controller.main_branch.F90 @@ -17,21 +17,27 @@ !! You should have received a copy of the GNU General Public License !! along with Galacticus. If not, see . +!+ Contributions to this file made by: Xiaolong Du + !!{ -Contains a module which implements a merger tree build controller class which builds trees containing only the main branch and -descendants of the node on the main branch above a certain mass fraction. +Implements a merger tree build controller class which builds trees containing only the main branch and +progenitors of the node on the main branch above a certain mass fraction. !!} !![ - A merger tree build controller class which builds trees containing only the main branch and descendants of the node on the main branch above a certain mass fraction. + + A merger tree build controller class which builds trees containing only the main branch and progenitors of the node on the + main branch above a certain mass fraction. Specifically, if a progenitor node of the node on the main branch has a mass + below a certain mass fraction relative to the main branch node, the branch will not grow any further. + !!] type, extends(mergerTreeBuildControllerClass) :: mergerTreeBuildControllerMainBranch !!{ - A merger tree build controller class which builds trees containing only the main branch and descendants of the node on the - main branch above a certain mass fraction. Specifically, if a descendant node of the node on the main branch has a mass - below a certain mass fraction relative to the main branch node, the node will not grow any further. + A merger tree build controller class which builds trees containing only the main branch and progenitors of the node on the + main branch above a certain mass fraction. Specifically, if a progenitor node of the node on the main branch has a mass + below a certain mass fraction relative to the main branch node, the branch will not grow any further. !!} private class (mergerTreeBranchingProbabilityClass), pointer :: mergerTreeBranchingProbability_ => null() @@ -69,7 +75,9 @@ function mainBranchConstructorParameters(parameters) result(self) massFraction parameters 0.0d0 - Mass fraction relative to the ancestor node on the main branch below which the descendant node does not grow any further. + + Mass fraction relative to the descendant node on the main branch below which the progenitor branch does not grow any further. + !!] @@ -109,9 +117,10 @@ subroutine mainBranchDestructor(self) return end subroutine mainBranchDestructor - logical function mainBranchControl(self,node,treeWalker_) + logical function mainBranchControl(self,node,treeWalker_) result(control) !!{ - Skip side branches of a tree under construction. + Skip side branches of a tree under construction if the mass of the node is below a certain fraction relative to its descendant + on the main branch. !!} use :: Galacticus_Nodes, only : nodeComponentBasic implicit none @@ -120,16 +129,16 @@ logical function mainBranchControl(self,node,treeWalker_) class(mergerTreeWalkerClass ), intent(inout), optional :: treeWalker_ class(nodeComponentBasic ) , pointer :: basic - mainBranchControl=.true. + control=.true. ! Move to the next node in the tree while such exists, and the mass of current node is below a certain fraction - ! relative to its ancestor on the main branch. - do while (mainBranchControl.and.associated(node%parent)) + ! relative to its descendant on the main branch. + do while (control.and.associated(node%parent)) basic => node%basic() - if(basic%mass() < self%massFraction*massAncestorOnMainBranch(node)) then + if (basic%mass() < self%massFraction*massDescendantOnMainBranch(node)) then if (present(treeWalker_)) then - mainBranchControl=treeWalker_%next(node) + control=treeWalker_%next(node) else - mainBranchControl=.false. + control=.false. end if else return @@ -138,24 +147,24 @@ logical function mainBranchControl(self,node,treeWalker_) return end function mainBranchControl - double precision function massAncestorOnMainBranch(node) + double precision function massDescendantOnMainBranch(node) result(mass) !!{ - Find the mass of the ancestor node on the main branch. + Find the mass of the descendant node on the main branch. !!} use :: Galacticus_Nodes, only : nodeComponentBasic implicit none type (treeNode ), intent(inout), pointer :: node - type (treeNode ) , pointer :: workNode + type (treeNode ) , pointer :: nodeWork class(nodeComponentBasic) , pointer :: basic - workNode => node - do while(.not.workNode%isOnMainBranch().and.associated(workNode%parent)) - workNode => workNode%parent + nodeWork => node + do while (.not.nodeWork%isOnMainBranch().and.associated(nodeWork%parent)) + nodeWork => nodeWork%parent end do - basic => workNode%basic() - massAncestorOnMainBranch = basic %mass () + basic => nodeWork%basic() + mass = basic %mass () return - end function massAncestorOnMainBranch + end function massDescendantOnMainBranch function mainBranchBranchingProbabilityObject(self,node) result(mergerTreeBranchingProbability_) !!{