#!gnumake
#RCS ID: $Id: Makefile 1484 2010-02-24 19:11:58Z  $
#
#Makefile for ca fd project
#by Robert Atwood
#
# This Makefile builds the requested version of the package, with 
# the requested type of debugging included. It enables rebuilding
# of only the object files required, for each version. This is 
# done by having a seperate subdirectory for each possible combination,
# therefore conflicting objects are not linked. (However it does not
# account for using a different compiler.) Each subdirectory contains its
# own Makefile, with minimal differences between them. 
# This Makefile detects the type of machine/compiler based on the setting
# of the ARCH environment variable which should be set to the output of the
# uname command. It also checks for the presence of the intel compiler by 
# looking for it in the PATH environment variable. 
# 
.EXPORT_ALL_VARIABLES:
.SUFFIXES:
.SUFFIXES: .c .o .d
.c.o:
	$(CC) $(CFLAGS)  $<


#for all systems
# unless overridden in system specific sections, these flags
# will always be used 

   #flags for all possible builds
#REG_LCDEFS = -DSYSNAME=$(SYSNAME) -DLIST_ALL_NUC -DPRINT_AV_PROFILE -DGLOBAL_UND_GRO -DAV_DIFF_COEFF -DNOSOLID -DCELL_DIFF_ARR  -DHISTO_NUC   -DALWAYS_NUC -DRANSLEY -DTEST_LINE_INT -DWRITE_BLOCK -DINCONEL -DNLM_FORMULA -DCA_DOUBLE -DIMAGEOUT -DCLOCK  -DALLSLICE  -fPIC 

REG_LCDEFS = -DSYSNAME=$(SYSNAME) -DLIST_ALL_NUC -DPRINT_AV_PROFILE -DGLOBAL_UND_GRO -DAV_DIFF_COEFF -DNOSOLID -DCELL_DIFF_ARR  -DHISTO_NUC   -DALWAYS_NUC -DRANSLEY -DTEST_LINE_INT -DWRITE_BLOCK -DINCONEL -DNLM_FORMULA -DCA_DOUBLE -DIMAGEOUT -DCLOCK  -DALLSLICE  -fPIC -DBL_COMPRESS

   #flags only for procast
   PRO_LCDEFS =  -DPROCAST_HEATFLUX -DPROCAST_CA -DPROCAST_3D -DUSER_2 #-DDMALLOC -DNOFS_PROCAST  -DQ_FEEDBACK_ROUTINE #-DVERBOSE_PROCAST -DPROBE_CELL=1275 -DMANYDUMPS 
   #needed for Windows version 
   EXE = 

   #memory-leak debugging library flags
   DBMFLAGS = -DDMALLOC

#NO LIBRARY (generic) section
   ifneq (,$(findstring NOLIB,$(ARCH)))
   WOFF = 
   #DFLAGS = -DALL_SIGS
   SYSLCOPTS = -DNOGETOPT -I/usr/include -I .. -I . -I ../read_list 
   DFLAGS =
   CC = gcc

#comment out the O3 to  disable the optimization for cygwin
   REG_OPT = #-O3 -ffast-math 
   DEB_OPT = -g
   PAR =

   LLDLIBS = -lm 
   # stripped and
   # static build for easy portability and small size
   # with the cygwin version -- fewer DLL files required
   # for the static version
   LDFLAGS = -static -s -L/usr/local/lib $(LLDLIBS)
   DEB_LIB = 
   SYSNAME = nolib
   NAME = nolib 
   
   EXE = 
endif
#end of CYGWIN section
#CYGWIN (windows pc) section
   ifneq (,$(findstring CYGWIN,$(ARCH)))
   WOFF = 
   #DFLAGS = -DALL_SIGS
   SYSLCOPTS = -I/usr/include -I .. -I . -I ../read_list  -DPNG_OUTPUT   
   DFLAGS = -Wall -DALL_SIGS -DGNU_TRAP_FPE -DREPLACERAND
   CC = gcc

#comment out the O3 to  disable the optimization for cygwin
   REG_OPT = -O3 #-ffast-math 
   DEB_OPT = -g
   PAR =

   LLDLIBS = -lgd -lpng -lm -lz
   # stripped and
   # static build for easy portability and small size
   # with the cygwin version -- fewer DLL files required
   # for the static version
   LDFLAGS = -L/usr/local/lib $(LLDLIBS)
   DEB_LIB = 
   SYSNAME = cygwin
   NAME = cyg
   
   EXE = .exe
endif
#end of CYGWIN section

#LINUX (pc) section
ifneq (,$(findstring Linux,$(ARCH)))
WOFF = 
DFLAGS = -Wall -DALL_SIGS -DGNU_TRAP_FPE -DREPLACERAND
CC =  gcc
# the name of the static analyser (like "lint")
LINT = splint -weak +ansilibq +posixlib +gnuextensions +relaxtypes -varuse -badflag -retvalother -bufferoverflowhigh 
# 
# may need to change for different machines
# but most are at least p3 
REG_OPT = -Wall #-ffast-math -march=pentium3
DEB_OPT = -ggdb  #-ffast-math  -march=pentium3
PAR =  #-j6

LLDLIBS = -lgd -lm 
LDFLAGS = -L/usr/local/lib $(LLDLIBS)
DEB_LIB =   #-lefence 
DBM_LIB = -ldmalloc

NAME = linux
SYSNAME = linux
SYSLCOPTS =  -I .. -I . -I ../read_list -DPNG_OUTPUT 
endif

#
#specific for hive2 arch
#
ifneq (,$(findstring hive2,$(HOSTNAME)))

ifneq (,$(findstring x86_64,$(MACH)))

   PBITS = 64

  #Intel icc options
  #don't forget to add the module in to the environment
  #CC=icc
  # REG_OPT =  -O4 -xW -ipo  -parallel # -tpp7 -openmp
  #gcc options
  CC=gcc
  #gcc 4.x.x is available but not trusted ...
  #CC=gccv4

  #for profiling
  # REG_OPT = -g -pg

  # uncomment Wall for lots of warnings
  #REG_OPT = -Wall -m64 -O3 -march=nocona

  #fastest case for hive2
  #with Robert's options   
   REG_OPT =  -m64 -O3 -march=nocona

  #Optimizer slows it down ???
  # REG_OPT =  -m64 -O1

   #REG_OPT = -m64 #-O3 -march=nocona
   #library location for 64 bit
   LDFLAGS = -L/usr/local/lib64 $(LLDLIBS)
   DEB_LIB = #-lefence
else
   PBITS = 32
   REG_OPT = -m32 -O3 -march=nocona
   DEB_OPT = -ggdb -m32 #-ffast-math  -march=pentium3
endif

NAME = hive2_${PBITS}

#CC = icc
else
ifneq (,$(findstring hive,$(HOSTNAME)))
# it will find the icc compiler anyways....
CC =  gccv333
#CC = icc

REG_OPT = -O3 -ffast-math -march=i686  # -O0 -xW -ipo
#gnu profiler options
#should not use debugging malloc libraray with profiling!
#REG_OPT = -g -pg  

DEB_OPT = -ggdb 
NAME = hive
endif
endif


MSG = "Finished making"

ifeq ($(strip $(ARCH)),)
CC = echo
SYSNAME = ERROR_NO_ARCH
NAME = ERROR_NO_ARCH
MSG = "ERROR ERROR ERROR !!!!! -- no ARCH variable detected! Please use the makeca script or set the environment variable to describe the system. Quitting with error: "
endif


CVERSION=


IFILES = oriented.inc 

#
#set up path to the source locations
#
# this is where the sub-Make will look for the specified files
#
SRCDIR = $(CURDIR):$(CURDIR)/read_list
vpath %.c  $(SRCDIR)
vpath %.h $(SRCDIR)
vpath %.inc $(SRCDIR)


#Files only for ca_procast
PCFILES =  user_rtns.c\
           user_rtn_cell.c\
           procast_userfuncs.c\
           ca_feedback.c

POBJ = $(PCFILES:.c=.o)
PDEP = $(PCFILES:.c=.d)

#files only if NOT ca_procast
#ie only for wrapper main
WCFILES = ca_wrapper.c
          
#          ca_solid.c

WOBJ = $(WCFILES:.c=.o)
WDEP = $(WCFILES:.c=.d)

#files only for ca_read
RCFILES = ca_read_wrapper.c 
ROBJ = $(RCFILES:.c=.o)
RDEP = $(RCFILES:.c=.d)




#files needed for reading in ASCII data files 
#and binary finite-element grid (Fgrid files, .fgb)
# these are located in a seperate subdirectory

CSVFILES =\
convert.c\
debin.c\
findvals.c\
freecsv.c\
init.c\
init_nuc_mould.c\
qsort_csv.c\
read_fg_list.c\
readwrite.c\
readwrite_data.c\
readwrite_fg.c\
unit_conv.c


#files needed for all systems and versions 
CFILES =\
alloc_bb.c\
alloc_multicomp.c\
alloc_sb.c\
bigblock.c\
ca_histo.c\
calc_sb.c\
ca_solid.c\
castats.c\
curvature.c\
curvature_3D.c\
checkblock.c\
checkgas.c\
checks.c\
close_sb.c\
fcopymat.c\
fg_read.c\
fidap_interp_calc.c\
find_max.c\
find_nmols.c\
findroot.c\
freeblock.c\
gaussdev.c\
getxyz.c\
grain_functions.c\
handlers.c\
icopymat.c\
initcube.c\
initface.c\
init_sb_neigh.c\
mould_sources.c\
nbhd_def.c\
nuc_functions.c\
nuc_lookup.c\
open_sb.c\
output_ex.c\
output_img.c\
p_growth.c\
pnuc_function.c\
pore_multi.c\
pore_routines.c\
pore_setup_multi.c\
pr_lookup.c\
props.c\
rand_square.c\
rand_step.c\
rcs_id.c\
read_blocks.c\
read_cap_ca.c\
read_ca_procast.c\
read_ctrl.c\
readgeoplus.c\
readmat.c\
readphase.c\
read_sb.c\
recr_extra.c\
safeopen.c\
sb_boundary.c\
sb_ca_step.c\
sb_diffuse_alloy.c\
sb_diffuse_gas.c\
sb_diffuse_gas_poly.c\
sb_get_surface_cells.c\
sb_line_int.c\
sb_nuc.c\
sb_temp_calc.c\
setup_mould_src_function.c\
setup_temp_func.c\
solprops_reader.c\
solprops_writer.c\
step_output.c\
subblock.c\
SurCellRoutines.c\
thermo_trace_calc.c\
temp_calc_melt.c\
thermo_trace_init.c\
trans_interp_calc.c\
wfact_r_calc.c\
wfact_z_calc.c\
write_bb_values.c\
write_blocks.c\
write_block_values.c\
write_ctrl_values.c\
write_grain_histo.c\
write_header_ctrl.c\
write_matprop_values.c\
write_nprop_values.c\
write_POREprop_values.c\
write_pprop_values.c\
calc_solprops_poly.c\
sb_decentred_step.c\
sb_diffuse_alloy_decentred.c\
window_move.c\
sb_decentred_step_poly.c\
sb_diffuse_alloy_decentred_poly.c\
ca_phy_calc.c\
plt_output.c\
vtk_output.c\
sb_max_uc.c\
ff_memoalloc.c\
ff_memoryall.c\
ff_initial.c\
ff_boundary.c\
ff_calc_temp.c\
ff_timestepcheck.c\
ff_vectortrans.c\
ff_newvelocity.c\
ff_ppe_iccgtest.c\
PPE_ICCG.c\
ff_ppesor.c\
ff_calc_velo.c\
ff_imp_fgh.c\
ff_bc_cyc.c\
phy_ca_memalloc.c\
phy_ca_tran.c\
replacerand.c\
window_move_3d.c\
ext_memalloc.c\
ext_readin.c\
olderror.c

#sb_diffuse_alloy_multi.c
#interpolate.c
#analythic.c



#ensure the last line does not have the backslash


#CCFILES = writeslice.C
# no cplusplus files just now
CCFILES = 

OFILES = $(CFILES:.c=.o)
DEPEND = $(CFILES:.c=.d)
CCOFILES = $(CCFILES:.C=.o)
CSVOFILES = $(CSVFILES:.c=.o)
OBJECTS = $(OFILES) $(CCOFILES) $(CSVOFILES)

HFILES = ca_matrix.h blocks.h fem.h machine.h writeblocks.h\
	readgeoplus.h readmat.h  read_sb.h\
	matprops.h nucprops.h read_ctrl.h find_max.h\
	colour.h temprops.h solprops.h cube.h \
	grain.h fidap.h output.h tcpl.h nbhd.h\
        sb_diffuse.h pore.h constants.h rcs_id.h\
	interp.h nearnode.h castats.h nuc_lookup.h\
	pr_struct.h temp_struct.h nuc_functions.h nucfuncs.h props.h gaussdev.h\
	ca_histo.h  histo_struct.h rand_step.h rand_square.h pore_routines.h\
        checks.h common.h gd.h gd_io.h temp_struct.h pr_struct.h\
	ca_phy_calc.h ff_mpflow.h datatrans.h curvature.h ff_memory.h phy_ca_tran.h\
        ext_inp.h multi_diff_props.h




ALLFILES = $(CFILES) $(HFILES) $(WFILES) $(IFILES) $(P_RES)\
            prop_wrapper.c Makefile localrules files.txt

# build the specific name of the program , with a .exe if under windows
CA_PROGRAM=ca_$(NAME)$(EXE)

# the main dependencies
default: $(CA_PROGRAM)

ca_deb: $(DBGFILES) 
#$(CA_PROGRAM) ca_deb: $(CFILES) $(CSVFILES) $(WCFILES) *.h
$(CA_PROGRAM) ca_deb: $(CFILES) $(WCFILES) *.h
ca_procast ca_procast_deb ca_procast_dbm: $(CFILES) $(PCFILES) *.h
ca_read ca_read_deb ca_read_dbm: $(CFILES) ca_read_wrapper.c

d: ca_deb


ofiles: $(OBJECTS)
	
# targets to run the static analyser (lint,splint)
prolint:
	$(LINT) -I .. -I .  -c $(LCDEFS)  -v ${CFILES} ${PCFILES} ${LLDLIBS} > lintout.txt
lint:
	$(LINT) -I .. -I .  -c $(LCDEFS)  -v ${CFILES} ${WCFILES} ${LLDLIBS} > lintout.txt

#set up the clean script for each target
clean: mclean 

mclean:
	rm -f $(CA_PROGRAM)
	cd multi_obj ; rm -f $(OBJECTS) $(WOBJ); rm -f *.il
rclean:
	rm -f ca_read
	cd read_obj ; rm -f $(OBJECTS) $(ROBJ)
rdclean:
	rm -f ca_read_deb
	cd read_deb_obj ; rm -f $(OBJECTS) $(ROBJ)
dbmclean:
	rm -f ca_dbm
	cd dbm_obj ; rm -f $(OBJECTS) $(WOBJ)
dclean:
	rm -f ca_deb
	cd deb_obj ; rm -f $(OBJECTS) $(WOBJ)
pclean:
	rm -f ca_procast
	cd pro_obj ; rm -f *.o; rm -f *.il
pdclean:
	rm -f ca_procast_deb
	cd pro_deb_obj ; rm -f *.o
pdbmclean:
	rm -f ca_procast_dbm
	cd pro_dbm_obj ; rm -f *.o
depclean:
	 rm -rvf */*.d
icc_clean:
	 rm -rvf */*.il

allclean: mclean dclean dbmclean pclean pdclean pdbmclean depclean rclean rdclean icc_clean

all: ca_read ca_read_deb ca_deb ca_dbm $(CA_PROGRAM) ca_procast ca_procast_deb ca_procast_dbm

#note shell script line to copy compilation flags into one-line include file
#this file gets included in the main wrapper (ca_wrapper)

debug:  dclean; echo "Cflags = strdup(\" `date` DEBUG: ${DFLAGS} REG: ${CFLAGS}\"); " > getcflags.inc; $(MAKE) $(PAR) ca_deb

#dependencies for each package type:
# for base ca package
ca_deb ca_dbm $(CA_PROGRAM): $(CFILES) $(WCFILES)

# for ca-read 
ca_read ca_read_deb ca_deb $(CA_PROGRAM): LCOPTS = $(SYSLCOPTS) 

#extra flags for procast 
ca_procast ca_procast_deb ca_procast_dbm: LCOPTS = $(SYSLCOPTS) $(PRO_LCDEFS)

#extra flag for DBMalloc
ca_dbm: LCOPTS = $(SYSLCOPTS) $(DBMFLAGS)

#the location of the objects subdirectory for this target
$(CA_PROGRAM) dep: OBJDIR = multi_obj
ca_deb: OBJDIR = deb_obj
ca_dbm: OBJDIR = dbm_obj
ca_procast: OBJDIR = pro_obj
ca_procast_deb: OBJDIR = pro_deb_obj
ca_procast_dbm: OBJDIR = pro_dbm_obj
ca_read: OBJDIR = read_obj
ca_read_deb: OBJDIR = read_deb_obj


#set up the optimizer flag (REGular or DEBug)
ca_read ca_procast $(CA_PROGRAM): OPTIMIZER = $(REG_OPT) 
ca_read_deb ca_procast_deb ca_procast_dbm ca_deb ca_dbm: OPTIMIZER = $(DEB_OPT)


#put the correct list of object files into the variable
#seems to work only with := syntax ??

ca_deb ca_dbm $(CA_PROGRAM): OBJECTS := $(OBJECTS) $(WOBJ)
ca_deb ca_dbm $(CA_PROGRAM): DEPEND := $(DEPEND) $(WDEP)
ca_procast_deb  ca_procast_dbm ca_procast: OBJECTS := $(OBJECTS) $(POBJ)
ca_procast_deb ca_procast_dbm ca_procast: DEPEND := $(DEPEND) $(PDEP)
ca_read_deb ca_read: OBJECTS := $(OBJECTS) $(ROBJ)
ca_read_deb ca_read: DEPEND := $(DEPEND) $(RDEP)


#ca_deb:	$(OBJECTS)
#	${CC} ${CFLAGS} -o $@ ${OBJECTS} $(WOBJ) ${LDFLAGS} -lefence 
#	echo $@;echo $(DTARG)
ca_deb ca_read_deb: LDFLAGS := $(LDFLAGS) $(DEB_LIB)
ca_dbm: LDFLAGS := $(LDFLAGS) $(DBM_LIB) 
ca_procast: LDFLAGS := -L..  $(LDFLAGS)  
ca_procast_deb: LDFLAGS := -L..  $(LDFLAGS) $(DEB_LIB)
ca_procast_dbm: LDFLAGS := -L..  $(LDFLAGS) $(DBM_LIB)

new:	mclean; $(MAKE) default


#
#the main thing: go to the object directory and build the objects
#then link, and copy the result back here
#also save the current c flags into a little file for inclusion into
#the source code -- this is done by the sub-Makefile in the object dir.
#
# this uses the phony target aprog
#
$(CA_PROGRAM) ca_deb ca_dbm ca_procast ca_procast_deb ca_procast_dbm ca_read ca_read_deb:
	cd $(OBJDIR) && $(MAKE) $(PAR) aprog;\
	mv prog$(EXE) ../$@;\
	echo $(MSG) $@
#
#just rebuild the dependency files
.PHONY: dep
dep:
	cd $(OBJDIR) && $(MAKE) dep; echo "Finished making " $@

#	${CC} $(CFLAGS) -o $@ ${OBJECTS}  $(WOBJ) ${LDFLAGS}

#ca_procast_deb ca_procast_new: $(OBJECTS) $(POBJ)
#	echo "Cflags = strdup(\"CFLAGS: $(CFLAGS)\");" > getcflags.inc;
#	$(CC)  $(CFLAGS) -o $@ $(OBJECTS) $(POBJ) -L.  ${LDFLAGS} 
#	echo $@
tags: $(CFILES)
	ctags *.c *.h

tar:	$(CFILES) $(WFILES)
	tar -cLovf cafiles.tar $(ALLFILES)
#	compress -f cafiles.tar


#RCS Log:$Log$
#RCS Log:Revision 11.5  2006/11/09 13:39:40  rcatwood
#RCS Log:Merged the update for ca_procast version for procast 2006.0_beta
#RCS Log:
#RCS Log:Revision 11.4.4.5  2006/11/06 20:18:17  rcatwood
#RCS Log:Improvements for coupled version
#RCS Log:Signal flag to reread output frequency from ca_newstep.in
#RCS Log:
#RCS Log:Revision 11.4.4.4  2006/11/03 17:08:04  rcatwood
#RCS Log:Added some useful lines for coupled version
#RCS Log:
#RCS Log:Revision 11.4.4.3  2006/11/02 18:48:06  rcatwood
#RCS Log:Fixed up old non-diffusion ca routine to work with coupled macro
#RCS Log:
#RCS Log:Revision 11.4.4.2  2006/10/30 17:09:08  rcatwood
#RCS Log:Added procast_heatflux definition to Makefile
#RCS Log:
#RCS Log:Revision 11.4.4.1  2006/10/25 15:57:48  rcatwood
#RCS Log:Altered files to work with procast_2006
#RCS Log:
#RCS Log:Revision 11.4  2006/06/07 19:37:10  rcatwood
#RCS Log:Fixed bug where pore is written when not selected
#RCS Log:
#RCS Log:Revision 11.3  2006/03/15 17:45:04  rcatwood
#RCS Log:Added ifdefs to exclude add-in librarys if desired
#RCS Log:Added more comments to procast interface routiens
#RCS Log:
#RCS Log:Revision 11.2  2006/03/01 18:25:48  rcatwood
#RCS Log:Optimiser alterateion
#RCS Log:
#RCS Log:Revision 11.1  2006/03/01 18:20:38  rcatwood
#RCS Log:Merging polycomponent and gas with meltback
#RCS Log:
#RCS Log:Revision 10.5.2.13  2006/02/22 15:54:37  rcatwood
#RCS Log:Mofidied Makefile to remove dependence on read_list for main program
#RCS Log:
#RCS Log:Revision 10.5.2.12  2006/02/20 14:27:25  rcatwood
#RCS Log:Corrected a typographical error in Cygwin section
#RCS Log:
#RCS Log:Revision 10.5.2.11  2006/02/20 12:00:13  lthuinet
#RCS Log:/* A lot of modifications : add an option to treat correctly diffusion in the case the secondary eutectic phase is stoechiometric AND add a pointer to distinguish the nature of the cell and the nature of the grain*/
#RCS Log:
#RCS Log:Revision 10.5.2.10  2006/02/01 14:36:48  rcatwood
#RCS Log:solved all implicit function declarations
#RCS Log:
#RCS Log:Revision 10.5.2.9  2006/02/01 14:16:25  lthuinet
#RCS Log:#update change of the calculation of supersaturation for gas in multicomponent
#RCS Log:
#RCS Log:Revision 10.5.2.8  2006/01/20 18:28:48  rcatwood
#RCS Log:Added _poly routines to the makefile
#RCS Log:
#RCS Log:Revision 10.5.2.7  2006/01/18 16:10:27  rcatwood
#RCS Log:Merged version that compiles
#RCS Log:NEW_MOULD_SRC option removed (this is the correct version now)
#RCS Log:
#RCS Log:Revision 10.5.2.6  2006/01/18 15:51:20  rcatwood
#RCS Log:Removed some multi and merged wti ludovic
#RCS Log:
#RCS Log:Revision 10.5.2.5  2006/01/18 12:01:17  lthuinet
#RCS Log:*** empty log message ***
#RCS Log:
#RCS Log:Revision 10.5.2.3  2006/01/11 16:31:31  rcatwood
#RCS Log:Altered the use of solute information to conform with the new solute information structure table
#RCS Log:
#RCS Log:Revision 10.5.2.2  2006/01/11 12:12:19  rcatwood
#RCS Log:Altered to use the new solute properties structure arrays
#RCS Log:
#RCS Log:Revision 10.5.2.1  2006/01/10 13:58:24  rcatwood
#RCS Log:Temporary branch for merging lthuinet poly-component and main branch
#RCS Log:
#RCS Log:Revision 10.5  2005/12/06 12:58:01  rcatwood
#RCS Log:Improved the to-do list information
#RCS Log:
#RCS Log:Revision 10.4  2005/12/01 14:15:22  rcatwood
#RCS Log:Improved splint flags
#RCS Log:
#RCS Log:Revision 10.3  2005/11/24 13:10:40  rcatwood
#RCS Log:Improved makefile, commented option for gcc 4
#RCS Log:
#RCS Log:Revision 10.2.2.3  2005/12/01 13:09:37  rcatwood
#RCS Log:Fixed some implicit function declarations
#RCS Log:
#RCS Log:Revision 10.2.2.2  2005/11/23 18:18:52  rcatwood
#RCS Log:Result of merging mould_source and xly meltback+curvature 2d versions
#RCS Log:
#RCS Log:Revision 10.2.2.1  2005/11/07 17:47:56  rcatwood
#RCS Log:Branch uisng Xiao Li Yang final version
#RCS Log:Revision 10.2  2005/11/07 17:27:05  rcatwood
#RCS Log:Altered Makefile and added make script to simplify multiplatform compilation
#RCS Log:
#RCS Log:Revision 10.1  2005/11/03 11:56:46  rcatwood
#RCS Log:New version number -- using mould_src as base
#RCS Log:
#RCS Log:Revision 8.12.6.2  2005/11/02 11:55:05  rcatwood
#RCS Log:Fixing up the revision nubmer after loss of repository
#RCS Log:
#RCS Log:Revision 9.20.4.9  2004/05/24 18:36:03  rcatwood
#RCS Log:Added individual surface nucleation parameters
#RCS Log:
#RCS Log:Revision 9.20.4.8  2004/04/07 11:18:30  rcatwood
#RCS Log:Fixed several division errors, added section to activate f.p.e. trapping
#RCS Log:
#RCS Log:Revision 9.20.4.7  2004/03/23 15:42:31  rcatwood
#RCS Log:Added compressed data handling into read/write blocks routines
#RCS Log:
#RCS Log:Revision 9.20.4.6  2004/03/09 11:30:52  rcatwood
#RCS Log:Changed to read materials properties from separate files for alloy and gas
#RCS Log:
#RCS Log:Revision 9.20.4.5  2004/03/04 11:29:24  rcatwood
#RCS Log:*** empty log message ***
#RCS Log:
#RCS Log:Revision 9.20.4.4  2004/01/30 19:13:53  rcatwood
#RCS Log:output the phase diagram info in dump file
#RCS Log:
#RCS Log:Revision 9.20.4.3  2004/01/29 14:19:39  rcatwood
#RCS Log:fixed no source (zero constant source) to work -- check speed?
#RCS Log:
#RCS Log:Revision 9.20.4.2  2004/01/06 16:16:05  rcatwood
#RCS Log:Fix memory leak in sb_write_raw
#RCS Log:
#RCS Log:Revision 9.20.4.1  2004/01/06 15:49:37  rcatwood
#RCS Log:Fixed surface nucleation to work wtih Procast - moved transfer of NOT_CASTING information into open_sb
#RCS Log:
#RCS Log:Revision 9.20  2003/12/05 18:25:10  rcatwood
#RCS Log: Improved the internal documentation of the Makefile
#RCS Log:
#RCS Log:Revision 9.19  2003/11/18 13:22:40  rcatwood
#RCS Log:Added routines to find and store the interface cells between the casting and the mould.
#RCS Log:Added the surface cell storage structure to the subblock.
#RCS Log:Improved mould source and nucleation  routines to use the surface cell structure
#RCS Log:
#RCS Log:Revision 9.18  2003/11/05 17:58:34  rcatwood
#RCS Log:*** empty log message ***
#RCS Log:
#RCS Log:Revision 9.17  2003/11/05 17:00:38  rcatwood
#RCS Log:Combined the ca_solid and ca_solid_procast into a single version (ca_solid.c)
#RCS Log:this required some changes to wrapper and other files
#RCS Log:
#RCS Log:Revision 9.16  2003/11/05 15:46:37  rcatwood
#RCS Log:Added a Make target for procast + dbmalloc
#RCS Log:
#RCS Log:Revision 9.15  2003/11/05 13:32:12  rcatwood
#RCS Log:Added dmalloc versions and dmalloc+procast versions
#RCS Log:
#RCS Log:Revision 9.14  2003/10/27 20:01:11  rcatwood
#RCS Log:Harmonized header file cpp protection
#RCS Log:Fixed filename bug for restart
#RCS Log:
#RCS Log:Revision 9.13  2003/10/23 17:36:56  rcatwood
#RCS Log:*** empty log message ***
#RCS Log:
#RCS Log:Revision 9.12  2003/10/23 16:32:39  rcatwood
#RCS Log:chagned signal result to allow writing of the final files on USR1
#RCS Log:
#RCS Log:Revision 9.11  2003/10/22 16:48:28  kerman
#RCS Log:Improved file suffix for cygwin
#RCS Log:
#RCS Log:Revision 9.10  2003/10/16 17:48:49  rcatwood
#RCS Log:reduced optimization for icc
#RCS Log:
#RCS Log:Revision 9.9  2003/10/16 12:40:19  rcatwood
#RCS Log:*** empty log message ***
#RCS Log:
#RCS Log:Revision 9.8  2003/10/07 10:08:51  rcatwood
#RCS Log:included intel compiler flags for linux
#RCS Log:
#RCS Log:Revision 9.7  2003/09/16 11:59:14  rcatwood
#RCS Log:Improved micro/macro interpolation
#RCS Log:
#RCS Log:Revision 9.6  2003/09/08 17:13:33  rcatwood
#RCS Log:changed ca_feedback to use the average of the nearest cells for each node.
#RCS Log:Fixed som warnings (implicit declarations)
#RCS Log:
#RCS Log:Revision 9.5  2003/09/04 13:46:55  rcatwood
#RCS Log:adjusted Makefile to use icc compiler on hive by default
#RCS Log:
#RCS Log:Revision 9.4  2003/09/02 14:01:01  rcatwood
#RCS Log:Changed Makefiles so that dependencies (.h) are automatically found using GNU make
#RCS Log:
#RCS Log:Revision 9.3  2003/08/14 15:37:19  rcatwood
#RCS Log:Universal Makefile with error check
#RCS Log:
#RCS Log:Revision 9.2  2003/08/14 15:20:31  rcatwood
#RCS Log:Universal Makefile
#RCS Log:
#RCS Log:Revision 9.1  2003/08/14 14:38:33  rcatwood
#RCS Log:Working merge with decentered/porosity/procast, also including
#RCS Log:Ali Chirazi's multicomponent (not tested in this version)
#RCS Log:
#RCS Log:Revision 1.1.2.1  2003/08/14 14:19:21  rcatwood
#RCS Log:Makefile for intel compiler
#RCS Log:
#RCS Log:Revision 8.11.2.26  2003/07/17 10:21:05  rcatwood
#RCS Log:Fix bug from mould_src if there is no mould
#RCS Log:
#RCS Log:Revision 8.11.2.25  2003/07/17 10:10:56  rcatwood
#RCS Log:activated supersaturation output for gas
#RCS Log:
#RCS Log:Revision 8.11.2.24  2003/06/30 16:35:01  rcatwood
#RCS Log:*** empty log message ***
#RCS Log:
#RCS Log:Revision 8.11.2.23  2003/05/16 16:23:06  rcatwood
#RCS Log:Simplified the print out routine.
#RCS Log:
#RCS Log:Revision 8.11.2.22  2003/05/14 11:49:53  rcatwood
#RCS Log:Fixed temperature input to conform wiht new temperature calculation methods
#RCS Log:and control input file
#RCS Log:
#RCS Log:Revision 8.11.2.21  2003/05/06 15:48:06  rcatwood
#RCS Log:Altered linear binary phase diagram usage to consistently use the values input from the control files rather than the header files.
#RCS Log:Revision 1.1.2.2  2003/07/11 11:06:59  rcatwood
#RCS Log:Added quick error message in Makefile if the ARCH variable is not set.
#RCS Log:
#RCS Log:Revision 8.11.2.20  2003/05/02 13:14:36  maijer
#RCS Log:Removed reference to T_EUT in sb_ca_step
#RCS Log:
#RCS Log:Revision 8.11.2.19  2003/03/21 18:16:40  rcatwood
#RCS Log:added flat (xy-plane) mulitblock geometry
#RCS Log:Tried to improve Makefile for ca_read
#RCS Log:
#RCS Log:Revision 8.11.2.18  2003/03/14 16:41:46  hdong
#RCS Log:Fixed temperature option selection for re-start.
#RCS Log:Fixed output_excel for restart case
#RCS Log:
#RCS Log:Revision 8.11.2.17  2003/03/14 14:45:35  rcatwood
#RCS Log:Added grain extent tracking
#RCS Log:Moved the grain update to a subroutine and call from sb_ca_step, capture_octahedron, and capture_octahedron_diffuse
#RCS Log:
#RCS Log:Revision 8.11.2.16  2003/03/13 14:15:57  rcatwood
#RCS Log:Added multiple zones for grain size measurement (hard coded)
#RCS Log:Added grain size counting in decentered (without diffusion)
#RCS Log:
#RCS Log:Revision 8.11.2.15  2003/02/27 23:04:38  rcatwood
#RCS Log:Removed use of old temperature routines , all temperatures shoudl
#RCS Log:be determined by checking the array c_temp in teh subblock, if the
#RCS Log:subblock is open
#RCS Log:
#RCS Log:Revision 8.11.2.14  2003/02/26 18:44:48  rcatwood
#RCS Log:Modified (non-decentered) so that the temperature uses an array
#RCS Log:calcuated before each step. Exception: Procast mode still overrides
#RCS Log:and uses Ali's routine.
#RCS Log:
#RCS Log:Revision 8.11.2.12  2003/02/21 15:36:48  rcatwood
#RCS Log:Added unit_conversion routine in read list package
#RCS Log:
#RCS Log:Revision 8.11.2.11  2003/02/05 14:31:15  rcatwood
#RCS Log:Added parallel (2 processors) to Linux section of Makefile
#RCS Log:
#RCS Log:Revision 8.11.2.10  2003/02/05 14:22:19  rcatwood
#RCS Log:*** empty log message ***
#RCS Log:
#RCS Log:Revision 8.11.2.9  2003/02/05 13:15:52  rcatwood
#RCS Log:Cross platform Makefile (SGI, Linux, Cygwin)
#RCS Log:
#RCS Log:Revision 8.11.2.8  2003/02/03 12:52:02  rcatwood
#RCS Log:Fixed some memory allocation bugs (seg fault if no fgrid input)
#RCS Log:
#RCS Log:Revision 8.11.2.7  2003/01/28 18:11:47  rcatwood
#RCS Log:ALL_SIG flag to disable signal blocking
#RCS Log:Fixed double free of node structure
#RCS Log:
#RCS Log:Revision 8.11.2.6  2003/01/23 17:47:27  rcatwood
#RCS Log:finite grid applied to decentered square,
#RCS Log:works, but not checked for correct results.
#RCS Log:
#RCS Log:Revision 8.11.2.5  2003/01/22 16:53:42  rcatwood
#RCS Log:Almost working read_fg version
#RCS Log:
#RCS Log:Revision 8.11.2.4  2003/01/17 16:09:29  rcatwood
#RCS Log:Before changing all FLOAT to CA_FLOAT
#RCS Log:
#RCS Log:Revision 8.11.2.3  2003/01/16 18:55:31  rcatwood
#RCS Log:Modified location of bb into ca_wrapper from ca_solid
#RCS Log:Makefile modified to use subdirectories
#RCS Log:
#RCS Log:Revision 8.11.2.2  2003/01/15 19:01:59  rcatwood
#RCS Log:*** empty log message ***
#RCS Log:
#RCS Log:Revision 8.5.2.4  2003/01/14 19:32:03  rcatwood
#RCS Log:working checkin - not for multicomponent however
#RCS Log:Temeprature routine still not harmonised
#RCS Log:
#RCS Log:Revision 8.5.2.3  2003/01/14 16:22:25  rcatwood
#RCS Log:Removed many lint warnings from sb_decentered_step
#RCS Log:Added signal function to ca_procast
#RCS Log:Removed some unused files
#RCS Log:
#Using gnu make
#RCS Log:Revision 8.5.2.2  2003/01/14 12:59:38  rcatwood
#RCS Log:Merged procast version which compiles successfullly
#RCS Log:Not checked for running yet
#RCS Log:Including WEI decentered square but not temperature routine links
#RCS Log:
#RCS Log:Revision 8.5.2.1  2002/11/06 17:27:45  rcatwood
#RCS Log:NOT WORKING check-in of first stage merge with ca_procast
#RCS Log:
#RCS Log:Revision 7.33.2.11  2002/11/05 14:25:02  rcatwood
#RCS Log:Changed block definintion files to split big and sub blocks to their own files
#RCS Log:
#RCS Log:Revision 7.33.2.10  2002/11/04 16:31:08  rcatwood
#RCS Log:** empty log message ***
#RCS Log:
#RCS Log:Revision 7.33.2.9  2002/11/04 11:22:04  rcatwood
#RCS Log:Check-in after Ali has gone
#RCS Log:
#RCS Log:Revision 7.33.2.8  2002/09/09 10:33:40  chirazi
#RCS Log:** empty log message ***
#RCS Log:
#RCS Log:Revision 7.33.2.7  2002/09/03 10:34:46  chirazi
#RCS Log:new modification rule for eutectic
#RCS Log:
#RCS Log:Revision 7.33.2.6  2002/08/30 14:57:46  chirazi
#RCS Log:adding the strontium modefication flag
#RCS Log:
#RCS Log:Revision 7.33.2.5  2002/08/28 20:43:30  chirazi
#RCS Log:No mass variation
#RCS Log:
#RCS Log:Revision 7.33.2.4  2002/08/27 14:18:16  chirazi
#RCS Log:adding files for multi-component-Procast version of CA
#RCS Log:
#RCS Log:Revision 7.25  2001/08/28 19:08:51  rcatwood
#RCS Log:thesis version
#RCS Log:
#RCS Log:Revision 7.24  2001/07/12 17:41:49  rcatwood
#RCS Log:** empty log message ***
#RCS Log:
#RCS Log:Revision 7.23  2001/07/06 15:18:04  rcatwood
#RCS Log:fixed another bug which caused seg fault when no pore mode selected
#RCS Log:
#RCS Log:Revision 7.22  2001/06/27 11:42:13  rcatwood
#RCS Log:added #IFDEF GLOBAL_UND_GRO or NUC cpp option.
#RCS Log:
