From bacca4729aac58dcc08859398ee3f07caa18f23e Mon Sep 17 00:00:00 2001
From: Dave Whipp <dwhipp@dal.ca>
Date: Tue, 14 Jun 2011 14:49:03 +0000
Subject: [PATCH] Added MPI stuff for subroutines

---
 src/NEST/Makefile        | 5 +++--
 src/NEST/stitch_nest.f90 | 8 ++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/NEST/Makefile b/src/NEST/Makefile
index 6ad5d934..30b32f09 100755
--- a/src/NEST/Makefile
+++ b/src/NEST/Makefile
@@ -13,6 +13,7 @@ OBJECTS = \
 ../define_cloud.o \
 ../define_ov.o \
 ../define_surface.o \
+../heap.o \
 ../read_controlling_parameters.o \
 ../read_input_file.o \
 stitch_nest.o \
@@ -24,9 +25,9 @@ OCTREE = ../OCTREE/libOctree$(BITS).a
 #
 all: $(BIN)
 $(BIN): $(OBJECTS)
-	@echo "$(F90) $(FFLAGS) $(INCLUDE) $(OPTIONS) $(OBJECTS) -o $(BIN)" \
+	@echo "$(F90) $(FFLAGS) $(INCLUDE) $(MPI_LIB) $(OPTIONS) $(OBJECTS) -o $(BIN)" \
 1>>$(BIN).link.stdout 2>>$(BIN).link.stderr
-	$(F90) $(FFLAGS) $(INCLUDE) $(OPTIONS) $(OBJECTS) $(OCTREE) -o $(BIN) \
+	$(F90) $(FFLAGS) $(INCLUDE) $(MPI_LIB) $(OPTIONS) $(OBJECTS) $(OCTREE) -o $(BIN) \
 1>>$(BIN).link.stdout 2>>$(BIN).link.stderr
 
 .PHONY: objclean
diff --git a/src/NEST/stitch_nest.f90 b/src/NEST/stitch_nest.f90
index 0266c2b1..c4c0e863 100644
--- a/src/NEST/stitch_nest.f90
+++ b/src/NEST/stitch_nest.f90
@@ -12,6 +12,8 @@ use threads
 
 implicit none
 
+include 'mpif.h'
+
 ! Variable type declaration
 character (len=4) :: cistep,cnnest
 
@@ -37,6 +39,10 @@ type (ziso) zi
 
 write (*,*) 'Program started'
 
+call mpi_init(ierr)
+call mpi_comm_size (mpi_comm_world,nproc,ierr)
+call mpi_comm_rank (mpi_comm_world,iproc,ierr)
+
 ! Init some variables
 current_time=0.d0
 inc=0.d0
@@ -83,6 +89,8 @@ enddo
 
 deallocate(ls_surf,ls_surf0)
 
+call mpi_finalize (ierr)
+
 ! Sign off
 write (*,*) 'Program execution complete'
 end
-- 
GitLab