Skip to content

Commit

Permalink
Merge pull request clawpack#29 from rjleveque/new-input-params
Browse files Browse the repository at this point in the history
New input params
  • Loading branch information
mandli committed Oct 10, 2012
2 parents f30f368 + 453ac13 commit d5f6a40
Show file tree
Hide file tree
Showing 11 changed files with 3,065 additions and 400 deletions.
51 changes: 26 additions & 25 deletions src/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ CLAW_PYTHON ?= $(PYTHON)

# Variables below should be set in Makefile that "includes" this one.
# Default values if not set:
CLAW_EXE ?= xclaw
EXE ?= xclaw
CLAW_PKG ?= classic
OUT_DIR ?= _output
PLOT_DIR ?= _plots
OUTDIR ?= _output
PLOTDIR ?= _plots
LIB_PATHS ?= $(CURDIR)/
OVERWRITE ?= True
RESTART ?= False
Expand Down Expand Up @@ -115,10 +115,10 @@ endif
.objs: $(MODULE_FILES) $(OBJECTS);

# The order here is to again build the module files correctly
$(CLAW_EXE): $(MODULE_FILES) $(MODULE_OBJECTS) $(OBJECTS) $(MAKEFILE_LIST) ;
$(LINK) $(MODULE_OBJECTS) $(OBJECTS) $(ALL_INCLUDE) $(ALL_LFLAGS) -o $(CLAW_EXE)
$(EXE): $(MODULE_FILES) $(MODULE_OBJECTS) $(OBJECTS) $(MAKEFILE_LIST) ;
$(LINK) $(MODULE_OBJECTS) $(OBJECTS) $(ALL_INCLUDE) $(ALL_LFLAGS) -o $(EXE)

.exe: $(CLAW_EXE)
.exe: $(EXE)

debug:
@echo 'debugging -- MODULES:'
Expand All @@ -131,7 +131,7 @@ debug:
#----------------------------------------------------------------------------

# Command to create *.html files from *.f etc:
CC2HTML = $(CLAW_PYTHON) $(CLAW)/doc/clawcode2html.py --force
CC2HTML = $(CLAW_PYTHON) $(CLAWUTIL)/src/python/clawutil/clawcode2html.py --force

# make list of html files to be created by 'make .htmls':
HTML = \
Expand Down Expand Up @@ -164,27 +164,27 @@ Makefile.html : Makefile ; $(CC2HTML) $<

# Make data files needed by Fortran code:
.data: $(SETRUN_FILE) $(MAKEFILE_LIST) ;
$(CLAW_PYTHON) $(SETRUN_FILE) $(CLAW_PKG)
touch .data
$(MAKE) data

data: $(MAKEFILE_LIST);
-rm -f .data
$(MAKE) .data
$(CLAW_PYTHON) $(SETRUN_FILE) $(CLAW_PKG)
touch .data

#----------------------------------------------------------------------------
# Run the code and put fort.* files into subdirectory named output:
# runclaw will execute setrun.py to create data files and determine
# what executable to run, e.g. xclaw or xamr.
.output: $(CLAW_EXE) .data $(MAKEFILE_LIST);
$(CLAW_PYTHON) $(CLAW)/clawutil/src/python/clawutil/runclaw.py $(CLAW_EXE) $(OUT_DIR) \
$(OVERWRITE) $(RESTART)
@echo $(OUT_DIR) > .output
.output: $(EXE) .data $(MAKEFILE_LIST);
$(MAKE) output

#----------------------------------------------------------------------------
# Run the code without checking dependencies:
output: $(MAKEFILE_LIST);
-rm -f .output
$(MAKE) .output
$(CLAW_PYTHON) $(CLAWUTIL)/src/python/clawutil/runclaw.py $(EXE) $(OUTDIR) \
$(OVERWRITE) $(RESTART)
@echo $(OUTDIR) > .output

#----------------------------------------------------------------------------

Expand All @@ -194,17 +194,18 @@ output: $(MAKEFILE_LIST);
# Plotting command
PLOTCMD ?= $(CLAW_PYTHON) $(VISCLAW)/src/python/visclaw/plotclaw.py

# Rule to make the plots into subdirectory specified by PLOT_DIR,
# using data in subdirectory specified by OUT_DIR and the plotting
# commands specified in CLAW_SETPLOT.
# Rule to make the plots into subdirectory specified by PLOTDIR,
# using data in subdirectory specified by OUTDIR and the plotting
# commands specified in SETPLOT_FILE.
.plots: .output $(SETPLOT_FILE) $(MAKEFILE_LIST) ;
$(PLOTCMD) $(OUT_DIR) $(PLOT_DIR) $(SETPLOT_FILE)
@echo $(PLOT_DIR) > .plots
$(MAKE) plots

# Make the plots without checking dependencies:
plots: $(SETPLOT_FILE) $(MAKEFILE_LIST);
-rm -f .plots
$(MAKE) .plots
$(PLOTCMD) $(OUTDIR) $(PLOTDIR) $(SETPLOT_FILE)
@echo $(PLOTDIR) > .plots


#----------------------------------------------------------------------------

Expand All @@ -226,13 +227,13 @@ new:
-rm -f $(OBJECTS)
-rm -f $(MODULE_OBJECTS)
-rm -f $(MODULE_FILES)
-rm -f $(CLAW_EXE)
$(MAKE) $(CLAW_EXE) MAKELEVEL=0
-rm -f $(EXE)
$(MAKE) $(EXE) MAKELEVEL=0


# Clean up options:
clean:
-rm -f $(CLAW_EXE) $(HTML)
-rm -f $(EXE) $(HTML)
-rm -f .data .output .plots .htmls

clobber:
Expand All @@ -241,7 +242,7 @@ clobber:
-rm -f $(MODULE_OBJECTS)
-rm -f $(MODULE_FILES)
-rm -f fort.* *.pyc pyclaw.log
-rm -f -r $(OUT_DIR) $(PLOT_DIR)
-rm -f -r $(OUTDIR) $(PLOTDIR)

#----------------------------------------------------------------------------

Expand Down
20 changes: 13 additions & 7 deletions src/python/clawutil/chardiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def chardiff_file(fname1, fname2, print_all_lines=True, hfile1='', \

if (len(f1) != len(f2)) and verbose:
print "*** files have different number of lines"
print " %s: %s lines" % (fname1,len(f1))
print " %s: %s lines" % (fname2,len(f2))
flen = min(len(f1), len(f2))

table1 = []
Expand Down Expand Up @@ -114,9 +116,6 @@ def chardiff_file(fname1, fname2, print_all_lines=True, hfile1='', \
numchanges = sum(changed)

html = open(hfile1,"w")
if verbose:
print "Point your browser to: "
print " view all %s lines with diffs: %s" % (flen, hfile1)
hf2 = os.path.split(hfile2)[1]
html.write("""
<html>
Expand Down Expand Up @@ -154,8 +153,6 @@ def chardiff_file(fname1, fname2, print_all_lines=True, hfile1='', \
# Only changed lines:

html = open(hfile2,"w")
if verbose:
print " view only %s lines with changes: %s" % (numchanges, hfile2)
hf1 = os.path.split(hfile1)[1]
html.write("""
<html>
Expand Down Expand Up @@ -211,7 +208,7 @@ def chardiff_dir(dir1, dir2, file_pattern='all', dir3="_char_diff",
checkfiles = filecmp.dircmp(dir1,dir2)
allsame = (checkfiles.diff_files==[]) and (checkfiles.left_list == checkfiles.right_list)

if allsame and verbose:
if allsame:
print "*All* files in the two directories are equal"
elif verbose:
if len(checkfiles.diff_files)>0:
Expand Down Expand Up @@ -343,7 +340,16 @@ def __init__(self, msg):

# Run diff
if os.path.isfile(args[0]) and os.path.isfile(args[1]):
sys.exit(chardiff_file(args[0],args[1],verbose=verbose))
try:
hfile1 = "diff_all_lines.html"
hfile2 = "diff_changed_lines.html"
(flen,numchanges) = chardiff_file(args[0],args[1],\
hfile1=hfile1,hfile2=hfile2,verbose=verbose)
print "View all %s lines with diffs: %s" % (flen, hfile1)
print "View only %s lines with changes: %s" % (numchanges, hfile2)
sys.exit(0)
except:
sys.exit(1)
elif os.path.isdir(args[0]) and os.path.isdir(args[1]):
if len(args) > 2:
if args[2][0] == '[':
Expand Down
Loading

0 comments on commit d5f6a40

Please sign in to comment.