From d68fec5fa6c936a567463cbfa316cd0bb4d27a10 Mon Sep 17 00:00:00 2001
From: Douglas Guptill <douglas.guptill@dal.ca>
Date: Mon, 29 Jun 2009 17:37:27 +0000
Subject: [PATCH] split long lines, print lsf size if different

---
 embed_surface_in_octree.f90 | 64 ++++++++++++++++++++++---------------
 1 file changed, 39 insertions(+), 25 deletions(-)

diff --git a/embed_surface_in_octree.f90 b/embed_surface_in_octree.f90
index 3daa6583..3222657e 100644
--- a/embed_surface_in_octree.f90
+++ b/embed_surface_in_octree.f90
@@ -1,7 +1,7 @@
 !------------------------------------------------------------------------------|
 !------------------------------------------------------------------------------|
 !                                                                              |
-!              ||===\\                                                         | 
+!              ||===\\                                                         |
 !              ||    \\                                                        |
 !              ||     ||   //==\\   ||  ||   //==||  ||/==\\                   |
 !              ||     ||  ||    ||  ||  ||  ||   ||  ||    ||                  |
@@ -72,7 +72,8 @@ if(iproc.eq.0) write(8,*) 'embedding surface',is,'/',params%ns
 ! we first create a uniform octree at level leveluniform_oct
 
 olsf%noctree=params%noctreemax
-allocate (olsf%octree(olsf%noctree),stat=threadinfo%err)         ; call heap (threadinfo,'olsf%octree', 'embed_surf...',size(olsf%octree),'int',+1)
+allocate (olsf%octree(olsf%noctree),stat=threadinfo%err)
+call heap (threadinfo,'olsf%octree', 'embed_surf...',size(olsf%octree),'int',+1)
 
 call octree_init (olsf%octree,olsf%noctree)
 call octree_create_uniform (olsf%octree,olsf%noctree,params%leveluniform_oct)
@@ -86,17 +87,22 @@ if (iproc.eq.0) write (8,*) olsf%nleaves,' leaves in lsf octree'
 ! we then calculate the  connectivity and node coordinates of the surface octree
 
 olsf%nnode=olsf%nleaves*3
-allocate (olsf%icon(8,olsf%nleaves),stat=threadinfo%err)  ; call heap (threadinfo,'olsf%icon','embed_surf...',size(olsf%icon),'int',+1)
-allocate (olsf%x(olsf%nnode),stat=threadinfo%err)         ; call heap (threadinfo,'olsf%x','embed_surf...',size(olsf%x),'dp',+1)
-allocate (olsf%y(olsf%nnode),stat=threadinfo%err)         ; call heap (threadinfo,'olsf%y','embed_surf...',size(olsf%y),'dp',+1)
-allocate (olsf%z(olsf%nnode),stat=threadinfo%err)         ; call heap (threadinfo,'olsf%z','embed_surf...',size(olsf%z),'dp',+1)
+allocate (olsf%icon(8,olsf%nleaves),stat=threadinfo%err)
+call heap (threadinfo,'olsf%icon','embed_surf...',size(olsf%icon),'int',+1)
+allocate (olsf%x(olsf%nnode),stat=threadinfo%err)
+call heap (threadinfo,'olsf%x','embed_surf...',size(olsf%x),'dp',+1)
+allocate (olsf%y(olsf%nnode),stat=threadinfo%err)
+call heap (threadinfo,'olsf%y','embed_surf...',size(olsf%y),'dp',+1)
+allocate (olsf%z(olsf%nnode),stat=threadinfo%err)
+call heap (threadinfo,'olsf%z','embed_surf...',size(olsf%z),'dp',+1)
    
 call octree_find_node_connectivity (olsf%octree,olsf%noctree,olsf%icon,olsf%nleaves,olsf%x,olsf%y,olsf%z,olsf%nnode)
 
 write(threadinfo%Logunit,*) '[same] embed_surface_in_octree: olsf%nnode ',olsf%nnode
 call flush(threadinfo%Logunit) 
 
-allocate (olsf%lsf(olsf%nnode),stat=threadinfo%err)         ; call heap (threadinfo,'olsf%lsf', 'embed_surf...',size(olsf%lsf),'dp',+1)
+allocate (olsf%lsf(olsf%nnode),stat=threadinfo%err)
+call heap (threadinfo,'olsf%lsf', 'embed_surf...',size(olsf%lsf),'dp',+1)
 
 ! we then calculate the lsf on the olsf octree
 
@@ -119,16 +125,20 @@ oint%noctree=osolve%noctree
 oint%nleaves=osolve%nleaves
 oint%nnode=osolve%nnode
 oint%nlsf=osolve%nlsf
-write(*,*) 'oint noctree,nleaves,nnode,nlsf are', oint%noctree,oint%nleaves,oint%nnode,oint%nlsf
-
-! Bug fixed by Jean on June 24 2009
-!allocate (oint%octree(oint%noctree),stat=threadinfo%err)         ; call heap (threadinfo,'oint%octree', 'embed_surf...',size(oint%octree),'int',+1)
-allocate (oint%octree(params%noctreemax),stat=threadinfo%err)         ; call heap (threadinfo,'oint%octree', 'embed_surf...',size(oint%octree),'int',+1)
-allocate (oint%icon(8,oint%nleaves),stat=threadinfo%err)         ; call heap (threadinfo,'oint%icon', 'embed_surf...',size(oint%icon),'int',+1)
-allocate (oint%lsf(oint%nnode,oint%nlsf),stat=threadinfo%err)    ; call heap (threadinfo,'oint%lsf', 'embed_surf...',size(oint%lsf),'dp',+1)
-allocate (oint%x(oint%nnode),stat=threadinfo%err)                ; call heap (threadinfo,'oint%x', 'embed_surf...',size(oint%x),'dp',+1)
-allocate (oint%y(oint%nnode),stat=threadinfo%err)                ; call heap (threadinfo,'oint%y', 'embed_surf...',size(oint%y),'dp',+1)
-allocate (oint%z(oint%nnode),stat=threadinfo%err)                ; call heap (threadinfo,'oint%z', 'embed_surf...',size(oint%z),'dp',+1)
+! write(threadinfo%mem_heap_unit,*) 'oint noctree,nleaves,nnode,nlsf are', oint%noctree,oint%nleaves,oint%nnode,oint%nlsf
+
+allocate (oint%octree(params%noctreemax),stat=threadinfo%err)
+call heap (threadinfo,'oint%octree', 'embed_surf...',size(oint%octree),'int',+1)
+allocate (oint%icon(8,oint%nleaves),stat=threadinfo%err)
+call heap (threadinfo,'oint%icon', 'embed_surf...',size(oint%icon),'int',+1)
+allocate (oint%lsf(oint%nnode,oint%nlsf),stat=threadinfo%err)
+call heap (threadinfo,'oint%lsf', 'embed_surf...',size(oint%lsf),'dp',+1)
+allocate (oint%x(oint%nnode),stat=threadinfo%err)
+call heap (threadinfo,'oint%x', 'embed_surf...',size(oint%x),'dp',+1)
+allocate (oint%y(oint%nnode),stat=threadinfo%err)
+call heap (threadinfo,'oint%y', 'embed_surf...',size(oint%y),'dp',+1)
+allocate (oint%z(oint%nnode),stat=threadinfo%err)
+call heap (threadinfo,'oint%z', 'embed_surf...',size(oint%z),'dp',+1)
 
 oint%octree=osolve%octree
 oint%icon=osolve%icon
@@ -136,13 +146,12 @@ if (size(oint%lsf).ne.size(osolve%lsf)) then
    write(*,*) 'oint%lsf = osolve%lsf; sizes differ', size(oint%lsf), size(osolve%lsf)
 endif
 oint%lsf=osolve%lsf
-
 oint%x=osolve%x
 oint%y=osolve%y
 oint%z=osolve%z
 
 ! having replicated osolve, we can deallocate it
-call heap (threadinfo,'osolve%icon','embed_surf...',size(osolve%icon),'int',-1)              ; deallocate (osolve%icon)                                     
+call heap (threadinfo,'osolve%icon','embed_surf...',size(osolve%icon),'int',-1)              ; deallocate (osolve%icon)
 call heap (threadinfo,'osolve%x','embed_surf...',size(osolve%x),'dp',-1)                     ; deallocate (osolve%x)    
 call heap (threadinfo,'osolve%y','embed_surf...',size(osolve%y),'dp',-1)                     ; deallocate (osolve%y) 
 call heap (threadinfo,'osolve%z','embed_surf...',size(osolve%z),'dp',-1)                     ; deallocate (osolve%z)
@@ -154,7 +163,7 @@ call octree_init (osolve%octree,osolve%noctree)
 osolve%octree=oint%octree
 
 ! we modify the osolve%octree by embedding the olsf in it
-allocate (levs(olsf%nleaves),stat=threadinfo%err)                ; call heap (threadinfo,'levs', 'embed_surf...',size(levs),'dp',+1)
+allocate (levs(olsf%nleaves),stat=threadinfo%err)       ; call heap (threadinfo,'levs', 'embed_surf...',size(levs),'dp',+1)
 call octree_find_element_level (olsf%octree,olsf%noctree,levs,olsf%nleaves)
 
 do ie=1,olsf%nleaves
@@ -177,10 +186,14 @@ osolve%nleaves = ioctree_number_of_elements(osolve%octree,osolve%noctree)
 osolve%nnode   = osolve%nleaves*3
 osolve%nlsf    = params%ns
 
-allocate (osolve%icon(8,osolve%nleaves),stat=threadinfo%err)        ; call heap (threadinfo,'osolve%icon','embed_surf...',size(osolve%icon),'int',+1)
-allocate (osolve%x(osolve%nnode),stat=threadinfo%err)               ; call heap (threadinfo,'osolve%x',   'embed_surf...',size(osolve%x),'dp',+1)
-allocate (osolve%y(osolve%nnode),stat=threadinfo%err)               ; call heap (threadinfo,'osolve%y',   'embed_surf...',size(osolve%y),'dp',+1)
-allocate (osolve%z(osolve%nnode),stat=threadinfo%err)               ; call heap (threadinfo,'osolve%z',   'embed_surf...',size(osolve%z),'dp',+1)
+allocate (osolve%icon(8,osolve%nleaves),stat=threadinfo%err)
+call heap (threadinfo,'osolve%icon','embed_surf...',size(osolve%icon),'int',+1)
+allocate (osolve%x(osolve%nnode),stat=threadinfo%err)
+call heap (threadinfo,'osolve%x',   'embed_surf...',size(osolve%x),'dp',+1)
+allocate (osolve%y(osolve%nnode),stat=threadinfo%err)
+call heap (threadinfo,'osolve%y',   'embed_surf...',size(osolve%y),'dp',+1)
+allocate (osolve%z(osolve%nnode),stat=threadinfo%err)
+call heap (threadinfo,'osolve%z',   'embed_surf...',size(osolve%z),'dp',+1)
 
 
 ! we build the icon array of osolve. the routine also outputs the real number of nodes osolve%nnode
@@ -189,7 +202,8 @@ call octree_find_node_connectivity (osolve%octree,osolve%noctree, &
                                     osolve%x,osolve%y,osolve%z,osolve%nnode)
 
 ! now that osolve%nnode is known we can allocate osolve%lsf
-allocate (osolve%lsf(osolve%nnode,osolve%nlsf),stat=threadinfo%err) ; call heap (threadinfo,'osolve%lsf', 'embed_surf...',size(osolve%lsf),'dp',+1)
+allocate (osolve%lsf(osolve%nnode,osolve%nlsf),stat=threadinfo%err)
+call heap (threadinfo,'osolve%lsf', 'embed_surf...',size(osolve%lsf),'dp',+1)
 
 ! if we are dealing with the last surface, nodes are renumbered
 if (params%renumber_nodes .and. is.eq.params%ns) then
-- 
GitLab