├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL.MD ├── INSTALL.PORTABLE ├── Makefile.am ├── NEWS ├── README ├── README.GUI ├── README.md ├── bootstrap.sh ├── configure.ac ├── dependencies_src ├── Python-2.7.13.tar.xz ├── gdal-2.1.0.tar.gz ├── hdf5-1.8.18.tar ├── pcre-8.37.tar.gz └── swig-3.0.5.tar.gz ├── doc ├── Makefile.am ├── Titan2D_User_Guide.pdf └── help │ ├── Makefile.am │ ├── Map.jhm │ ├── Titan.hs │ ├── TitanIndex.xml │ ├── TitanTOC.xml │ └── html │ ├── Makefile.am │ ├── discharge.html │ ├── flux.html │ ├── gis.html │ ├── jobmonitor.html │ ├── jobsubmission.html │ ├── load_save.html │ ├── material_model_and_map.html │ ├── options.html │ ├── output_options.html │ ├── piles.html │ ├── run_parameters.html │ └── welcome.html ├── docker ├── Dockerfile_titan2d_ready_centos ├── README.MD ├── titan2d_bin_maker_centos6.Dockerfile ├── titan2d_bin_maker_centos7.Dockerfile ├── titan2d_bin_maker_ubuntu18.Dockerfile └── utils │ └── titan2d_bin_maker ├── gui ├── Makefile.am ├── derby.jar ├── jh.jar ├── titan │ ├── graphics │ │ ├── CheckBoxGroup.java │ │ ├── DirectorySelector.java │ │ ├── IValueComponent.java │ │ ├── LabelDisplay.java │ │ ├── RadioButtonGroup.java │ │ ├── SpringUtilities.java │ │ ├── TextArea.java │ │ └── TextInput.java │ ├── gui │ │ ├── DefaultTitanData.java │ │ ├── JobDetailsDialog.java │ │ ├── RunStyleDialog.java │ │ ├── TabDischargePlanes.java │ │ ├── TabFileIO.java │ │ ├── TabFluxSources.java │ │ ├── TabGIS.java │ │ ├── TabJobMonitor.java │ │ ├── TabJobSubmission.java │ │ ├── TabMaterialModelMap.java │ │ ├── TabOutputOptions.java │ │ ├── TabPiles.java │ │ ├── TabRunParameters.java │ │ ├── Titan.java │ │ ├── TitanConstants.java │ │ ├── TitanTab.java │ │ └── TitanTabList.java │ ├── io │ │ ├── GenericReader.java │ │ ├── INameValuePair.java │ │ ├── InputReader.java │ │ ├── NameValuePairComponent.java │ │ ├── NameValuePairGroup.java │ │ ├── NameValuePairSimple.java │ │ ├── OutputWriter.java │ │ ├── ParameterInput.java │ │ ├── ParameterListInput.java │ │ ├── ParameterListOutput.java │ │ ├── ParameterOutput.java │ │ └── TitanDBAccess.java │ ├── jobs │ │ ├── JobDetails.java │ │ ├── JobStatus.java │ │ ├── JobStatusProcessor.java │ │ ├── JobSubmissionContainer.java │ │ ├── JobSubmissionParameters.java │ │ ├── RunMethod.java │ │ ├── TitanRunInput.java │ │ ├── condor │ │ │ ├── CondorHistoryProcessor.java │ │ │ ├── CondorJobStatusProcessor.java │ │ │ ├── CondorQProcessor.java │ │ │ ├── JobStatusCondor.java │ │ │ └── RunMethodCondor.java │ │ ├── local │ │ │ ├── JobStatusLocal.java │ │ │ └── RunMethodLocal.java │ │ ├── pbs │ │ │ ├── JobStatusPBS.java │ │ │ ├── QstatProcessor.java │ │ │ └── RunMethodPBS.java │ │ └── submit │ │ │ ├── JobStatusSubmit.java │ │ │ └── RunMethodSubmit.java │ └── options │ │ ├── OptionsDialog.java │ │ └── OptionsManager.java └── titan_gui.sh.in ├── py-compile ├── scripts ├── FreeSerif.ttf ├── Makefile.am ├── blankheight.png ├── boundaries.py ├── boundariesMultiProcessor.py ├── combineFiles.py ├── createLabel.py ├── createVolcanoKML_POLYGONS_ANIMATION.py ├── createVolcanoKML_POLYGONS_LASTFRAME.py ├── driverKML.sh.in ├── driverMultiProcessor.sh.in ├── gnuplot.py ├── h5dump.py ├── lava.py ├── lava_points.py ├── parseXML.py ├── r.gmfg.titan ├── s.in.titan ├── titan2d_pyapi_prototype.py ├── titan_gui.py ├── titan_pilehelper ├── titan_regionhelper └── utmToLatLng.py ├── share ├── Makefile.am └── titan2d_examples │ ├── colimafinemini │ ├── Coulomb │ │ └── input.py │ ├── Coulomb_FluxSrc_DischPlane │ │ └── input.py │ ├── Coulomb_GeoTIFF │ │ └── input.py │ ├── Coulomb_all_param_explicit │ │ └── input.py │ ├── Coulomb_with_stopping │ │ └── input.py │ ├── Pouliquen_Forterre │ │ └── input.py │ ├── TwoPhases_Pitman_Le │ │ └── input.py │ └── Voellmy_Salm │ │ └── input.py │ ├── dem │ ├── colimacoarse │ │ └── PERMANENT │ │ │ ├── .bash_history │ │ │ ├── .bashrc │ │ │ ├── .gislock │ │ │ ├── .tmp │ │ │ └── blackbox │ │ │ │ └── 6758.0.ppm │ │ │ ├── DEFAULT_WIND │ │ │ ├── MYNAME │ │ │ ├── PROJ_INFO │ │ │ ├── PROJ_UNITS │ │ │ ├── VAR │ │ │ ├── WIND │ │ │ ├── cats │ │ │ └── colima │ │ │ ├── cell │ │ │ └── colima │ │ │ ├── cell_misc │ │ │ └── colima │ │ │ │ ├── f_format │ │ │ │ ├── f_quant │ │ │ │ ├── f_range │ │ │ │ └── null │ │ │ ├── cellhd │ │ │ └── colima │ │ │ ├── fcell │ │ │ └── colima │ │ │ ├── hist │ │ │ └── colima │ │ │ └── sqlite │ │ │ └── sqlite.db │ ├── colimafinemini.geotiff │ ├── colimafinemini │ │ └── PERMANENT │ │ │ ├── .bash_history │ │ │ ├── .bashrc │ │ │ ├── .gislock │ │ │ ├── .tmp │ │ │ └── blackbox │ │ │ │ └── 6586.0.ppm │ │ │ ├── DEFAULT_WIND │ │ │ ├── MYNAME │ │ │ ├── PROJ_INFO │ │ │ ├── PROJ_UNITS │ │ │ ├── VAR │ │ │ ├── WIND │ │ │ ├── cats │ │ │ └── colima │ │ │ ├── cell │ │ │ └── colima │ │ │ ├── cell_misc │ │ │ └── colima │ │ │ │ ├── f_format │ │ │ │ ├── f_quant │ │ │ │ ├── f_range │ │ │ │ └── null │ │ │ ├── cellhd │ │ │ └── colima │ │ │ ├── fcell │ │ │ └── colima │ │ │ └── hist │ │ │ └── colima │ └── inclined │ │ └── PERMANENT │ │ ├── DEFAULT_WIND │ │ ├── VAR │ │ ├── WIND │ │ ├── cats │ │ ├── inclined │ │ └── inclined_Mat │ │ ├── cell │ │ ├── inclined │ │ └── inclined_Mat │ │ ├── cell_misc │ │ ├── inclined │ │ │ ├── f_format │ │ │ ├── f_quant │ │ │ ├── f_range │ │ │ └── null │ │ └── inclined_Mat │ │ │ ├── null │ │ │ └── range │ │ ├── cellhd │ │ ├── inclined │ │ └── inclined_Mat │ │ ├── colr │ │ └── inclined_Mat │ │ ├── fcell │ │ └── inclined │ │ ├── hist │ │ ├── inclined │ │ └── inclined_Mat │ │ ├── sqlite │ │ └── sqlite.db │ │ └── vector │ │ └── inclined_Map1 │ │ ├── cidx │ │ ├── coor │ │ ├── dbln │ │ ├── head │ │ ├── hist │ │ ├── sidx │ │ └── topo │ ├── inclined │ ├── Coulomb │ │ └── input.py │ └── Coulomb_MatMap │ │ └── input.py │ └── run_all_examples.sh ├── shippable.yml ├── src ├── Makefile.am ├── adapt │ ├── Makefile.am │ ├── depchk.C │ ├── hadpt.C │ ├── refine2.C │ ├── unrefine.C │ ├── update_info_interp.C │ └── updatenei.C ├── datstr │ ├── Makefile.am │ ├── element2.C │ ├── elements_properties.C │ ├── hashtab2.C │ ├── htflush.C │ ├── node.C │ └── sfc.C ├── geoflow │ ├── Makefile.am │ ├── edge_states.C │ ├── element_weight.C │ ├── flux_srcs.C │ ├── get_coef_and_eigen.C │ ├── integrators.C │ ├── move_data.C │ ├── rnr.h │ ├── setup_geoflow.C │ ├── slopes.C │ └── stats.C ├── gisapi │ ├── GdalApi.cc │ ├── GisApi.C │ ├── GisApi.h │ ├── GisAscFile.C │ ├── GisAscFile.h │ ├── GisBinFile.C │ ├── GisBinFile.h │ ├── GisCats.C │ ├── GisCats.h │ ├── GisColors.C │ ├── GisColors.h │ ├── GisGrid.C │ ├── GisGrid.h │ ├── GisLabels.C │ ├── GisLabels.h │ ├── GisLines.C │ ├── GisLines.h │ ├── GisRasterHdr.C │ ├── GisRasterHdr.h │ ├── GisSPRFile.C │ ├── GisSPRFile.h │ ├── GisTriFile.C │ ├── GisTriFile.h │ ├── Makefile.am │ └── gmfg_GdalApi.h ├── header │ ├── FileFormat.h │ ├── Makefile.am │ ├── blas.h │ ├── constant.h │ ├── element2.h │ ├── element_inline.h │ ├── elements_properties_inline.hpp │ ├── elenode.hpp │ ├── extfun.h │ ├── exvar.h │ ├── flux_srcs.h │ ├── geoflow.h │ ├── hadapt.h │ ├── hadapt_inline.hpp │ ├── hashtab.h │ ├── hd5calls.h │ ├── hpfem.h │ ├── integrators.h │ ├── node.h │ ├── node_inline.h │ ├── outline.h │ ├── properties.h │ ├── refined_neighbor_info.h │ ├── scale.h │ ├── sfc.h │ ├── stats.hpp │ ├── struct.h │ ├── ticore.hpp │ ├── ticore │ │ ├── omp_mpi.hpp │ │ ├── tisearch.hpp │ │ └── tisort.hpp │ ├── titan2d.h │ ├── titan2d_utils.h │ ├── titan_simulation.h │ └── tivector.h ├── main │ ├── Makefile.am │ ├── cxxtitan.i │ ├── datread.C │ ├── delete_tab.C │ ├── hilbert.C │ ├── init_piles.C │ ├── properties.C │ ├── restart.C │ ├── titan.C │ ├── titan.py │ ├── titan2d_utils.C │ ├── titan_simulation.C │ ├── titanvars.sh.in │ └── update_topo.C ├── preproc │ ├── Makefile.am │ ├── boundary_preproc.C │ ├── boundary_preproc.h │ ├── createfunky.C │ ├── element_preproc.C │ ├── element_preproc.h │ ├── hilbert.C │ ├── materialnames.C │ ├── node_preproc.C │ ├── node_preproc.h │ ├── preproc.h │ └── preprocess.C ├── repartition │ ├── BSFC_combine_elements.C │ ├── BSFC_create_bins.C │ ├── BSFC_refine_partition.C │ ├── BSFC_update_and_send_elements.C │ ├── BSFC_update_element_proc.C │ ├── Makefile.am │ ├── fill.C │ ├── new_datatype.C │ ├── repartition_BSFC.C │ ├── repartition_BSFC.h │ └── update_element_info.C ├── stochastic │ ├── Makefile.am │ ├── dist-stats.pl │ ├── gentitanteststats.C │ ├── lhs.readme │ ├── lhsbed.C │ ├── lhslib.C │ ├── lhslib.h │ ├── lhstitanstats.C │ ├── lhsvol.C │ ├── pbslhs │ └── plot_stats.pl ├── tecplot │ ├── Makefile.am │ ├── grassout.C │ ├── hd5calls.C │ ├── outsum.C │ ├── tecplot.C │ └── xdfm_write.C ├── tests │ └── tivector_test.C ├── testutil │ └── compare_hdf5.py ├── useful │ ├── Makefile.am │ ├── useful_lib.C │ └── useful_lib.h └── vectordatapreproc │ ├── Makefile.am │ ├── cgis_trigrid.cpp │ ├── cgis_trigrid.h │ ├── cgis_vectordata.cpp │ ├── cgis_vectordata.h │ ├── cpolyline.cpp │ ├── cpolyline.h │ ├── vectordatpreproc.cpp │ └── vectordatpreproc.h └── tests ├── Makefile.am ├── ticore ├── Makefile.am ├── ticore_test.cpp ├── ticore_tisearch.hpp └── ticore_tisort.hpp └── titest_common.hpp /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | *.Po 7 | bin/ 8 | 9 | # Compiled Dynamic libraries 10 | *.so 11 | *.dylib 12 | *.dll 13 | 14 | # Compiled Static libraries 15 | *.lai 16 | *.la 17 | *.a 18 | *.lib 19 | 20 | # Executables 21 | *.exe 22 | *.out 23 | *.app 24 | 25 | # Eclipse and other IDE 26 | .autotools 27 | .cproject 28 | .project 29 | .settings 30 | .idea 31 | /.pydevproject 32 | /nbproject 33 | 34 | #autotols generated files 35 | autom4te.cache 36 | Makefile.in 37 | /compile 38 | /config.guess 39 | /config.sub 40 | /configure 41 | /depcomp 42 | /install-sh 43 | /missing 44 | /config.h.in~ 45 | /config.h.in 46 | /aclocal.m4 47 | /config.log 48 | /ltmain.sh 49 | /src/header/titan_config.h.in 50 | /src/header/titan_config.h.in~ 51 | #configure generated file, for thouse who like to compile in source 52 | Makefile 53 | 54 | #swig generated 55 | /src/main/cxxtitan.py 56 | /src/main/cxxtitan_wrap.cxx 57 | 58 | #binaries 59 | /bin 60 | src/vectordatapreproc/VecDataPreproc 61 | src/stochastic/lhsvol 62 | src/stochastic/lhstitanstats 63 | src/stochastic/lhsbed 64 | src/stochastic/gentitanteststats 65 | src/preproc/titan_preprocess 66 | src/preproc/titan_materialnames 67 | src/main/titan 68 | src/tests/tivector_test 69 | 70 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Developed by: Geophysical Mass Flow Group 2 | University at Buffalo 3 | http://www.gmfg.buffalo.edu/ 4 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003 University at Buffalo 2 | All rights reserved. 3 | 4 | Developed by: Geophysical Mass Flow Group 5 | University at Buffalo 6 | http://www.gmfg.buffalo.edu/ 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining 9 | a copy of this software and associated documentation files (the 10 | "Software"), to deal with the Software without restriction, including 11 | without limitation the rights to use, copy, modify, merge, publish, 12 | distribute, sublicense, and/or sell copies of the Software, and to 13 | permit persons to whom the Software is furnished to do so, subject to 14 | the following conditions: 15 | 16 | * Redistributions of source code must retain the above copyright 17 | notice, this list of conditions and the following disclaimers. 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimers in 20 | the documentation and/or other materials provided with the 21 | distribution. 22 | * Neither the names of Geophysical Mass Flow Group, University at 23 | Buffalo, nor the names of its contributors may be used to endorse 24 | or promote products derived from this Software without specific 25 | prior written permission. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 29 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 30 | NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT 31 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 32 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 33 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE 34 | SOFTWARE. 35 | 36 | Document Revision: $Id: COPYING 2 2003-08-13 19:26:11Z sorokine $ 37 | 38 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2016-05-25 Titan-2D 4.0.0 Release 2 | Major work was done on implementing new interfaces, optimizing and refractoring code, addition of new methods. 3 | 4 | * New python interface and titan execution scheme. 5 | * Titan-2D uses python script as input now 6 | * no more preprocessing and executable copying 7 | 8 | * Code optimizations 9 | * Hybrid OpenMP/MPI scheme 10 | * More than x9 improvement in serial and OpenMP executions 11 | * MPI was not optimized yet therefore OpenMP is parallelization method for now 12 | 13 | * New methods and capabilities 14 | * Voellmy-Salm, Pouliquen-Forterre and TwoPhases-Pitman-Le methods were added in addition to Coulomb method 15 | * Restarting capabilities were restored and it uses HDF5 format. Restart files are viewable through Paraview 16 | allowing visualization majority of internal variables 17 | 18 | * GUI 19 | * Java based GUI 20 | 21 | 2012-03-31 22 | 1. Added Gdal support for non-grass DEM formats 23 | 2. v* is rescalled with maximum possible free-fall velocity 24 | 3. Kinetic Energy maps are producded along with max pile height maps (attn. hazmap users) 25 | 4. Minor bugfixes 26 | 27 | 2009-06-16 28 | 1. Updated Paraview support to XDMF 2.0 29 | 2. Changed GisApi to include large file support 30 | 31 | 2003-08-14 First public release 32 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for the top-most source directory 3 | # 4 | # $Id: Makefile.am 235 2012-03-29 07:04:35Z dkumar $ 5 | # 6 | 7 | SUBDIRS = src scripts gui doc tests share 8 | 9 | install-data-local: 10 | @if [ "$(TITAN2D_PORTABLE)" = "yes" ]; then \ 11 | echo "Moving dependencies"; \ 12 | rsync -a $(TITAN2D_DEP) $(libdir); \ 13 | echo "Clean-up dependencies"; \ 14 | rm $(libdir)/titan2d_dep/lib/*.a; \ 15 | fi 16 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | See ChangeLog for changes summary. 2 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | README.md -------------------------------------------------------------------------------- /README.GUI: -------------------------------------------------------------------------------- 1 | -- RUNNING THE TITAN2D GUI -- 2 | 3 | == Platform == 4 | 5 | The Titan2D GUI is written in java, which is platform independent. However, some of the underlying implementation issues Unix/Linux commands. So, the Titan2D GUI should only be run on a Unix/Linux operating system. 6 | 7 | == Java == 8 | 9 | The Titan2D GUI requires that java version 1.7 or greater is installed and that the java executable(java) can be launched from the command line. 10 | 11 | To determine if java can be launched from the command line, issue the command: 12 | 13 | which java 14 | 15 | If java can be launched from the command line, determine which version of java is installed with the following command: 16 | 17 | java -version 18 | 19 | On CCR's general compute cluster, rush, verify that an approriate version of Java is loaded. For example, module load java/1.7.0_25. 20 | 21 | If java is not installed or the installed version of java is not 1.7 or greater, contact the system administator for assistance. 22 | 23 | OR 24 | 25 | Download java (version 1.7 or greater) and set the PATH environment variable to use the java executable included in the download. There are several different java vendors. 26 | 27 | ORACLE's latest version of java can be found at: 28 | https://www.oracle.com/java/index.html(as of 05/28/2016) 29 | 30 | == Titan2D Application Installation == 31 | 32 | The Titan2D GUI is now installed with the Titan2D Application. 33 | Please see the install notes in INSTALL for more information on installing the Titan2D Application. 34 | 35 | == Running the Titan2D GUI == 36 | 37 | The Titan2D GUI is launched from the titan_gui.sh shell script that is located in the /bin directory and invoked by the command: 38 | 39 | titan_gui.sh 40 | 41 | == Help using the Titan2D GUI == 42 | 43 | An explanation of the Titan2D GUI components is available from the Help menu on the main toolbar of the Titan2D GUI application. Detailed information is also provided in the Titan2D Mass-Flow Simulation Tool User Guide. -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | aclocal 4 | autoheader 5 | autoconf 6 | automake --add-missing --copy 7 | -------------------------------------------------------------------------------- /dependencies_src/Python-2.7.13.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/dependencies_src/Python-2.7.13.tar.xz -------------------------------------------------------------------------------- /dependencies_src/gdal-2.1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/dependencies_src/gdal-2.1.0.tar.gz -------------------------------------------------------------------------------- /dependencies_src/hdf5-1.8.18.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/dependencies_src/hdf5-1.8.18.tar -------------------------------------------------------------------------------- /dependencies_src/pcre-8.37.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/dependencies_src/pcre-8.37.tar.gz -------------------------------------------------------------------------------- /dependencies_src/swig-3.0.5.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/dependencies_src/swig-3.0.5.tar.gz -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for the doc/ directory 3 | # 4 | # $Id: 5 | # 6 | 7 | SUBDIRS = help 8 | 9 | clean: 10 | rm -fr manual 11 | 12 | -------------------------------------------------------------------------------- /doc/Titan2D_User_Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/doc/Titan2D_User_Guide.pdf -------------------------------------------------------------------------------- /doc/help/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for the doc/help subdirectory 3 | # 4 | # $Id: $ 5 | # 6 | 7 | SUBDIRS = html 8 | 9 | # Using doc prefix on the DATA primary, 10 | # install as data files in the $(docdir) directory 11 | doc_DATA = Map.jhm Titan.hs TitanIndex.xml TitanTOC.xml 12 | -------------------------------------------------------------------------------- /doc/help/Map.jhm: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /doc/help/Titan.hs: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | Titan Help 10 | 11 | 12 | 13 | top 14 | 15 | 16 | 17 | 18 | 19 | TOC 20 | 21 | javax.help.TOCView 22 | TitanTOC.xml 23 | 24 | 25 | 33 | 34 | 44 | 45 | 46 | main window 47 | 48 | 49 | Titan Help 50 | toplevelfolder 51 | 52 | javax.help.BackAction 53 | javax.help.ForwardAction 54 | javax.help.SeparatorAction 55 | javax.help.HomeAction 56 | javax.help.ReloadAction 57 | javax.help.SeparatorAction 58 | javax.help.PrintAction 59 | javax.help.PrintSetupAction 60 | 61 | 62 | 63 | main 64 | 65 | 66 | Titan Help 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /doc/help/TitanIndex.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /doc/help/TitanTOC.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /doc/help/html/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for the doc/help/html directory 3 | # 4 | # $Id: $ 5 | # 6 | # Using doc prefix on the DATA primary, 7 | # install as data files in the $(docdir) directory 8 | doc_DATA = welcome.html options.html load_save.html gis.html run_parameters.html \ 9 | output_options.html material_model_and_map.html piles.html flux.html discharge.html \ 10 | jobsubmission.html jobmonitor.html 11 | -------------------------------------------------------------------------------- /doc/help/html/discharge.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Help Overview 6 | 7 | 8 | 9 | 10 |

Discharge Planes

11 | Enter the coordinates of the two endpoints of a vertically-oriented 12 | discharge-plane. 13 | 14 |

Point A UTM E

15 | 16 |

Point A UTM N

17 | 18 |

Point B UTM E

19 | 20 |

Point B UTM N

21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /doc/help/html/flux.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Help Overview 6 | 7 | 8 | 9 | 10 |

Flux Sources

11 | 12 |

Define the diachronic material sources for the simulation.

13 | 14 |

Extrusion Rate

15 | A decimal value can be entered in this text field. 16 | The rate at which material extrudes vertically from the ground. 17 | The field cannot be left blank. 18 | 19 |

Active Time Start

20 | A decimal value, in seconds, can be entered in this text field. 21 | Specify a starting time for the flux source that can encompass either part or all of the simulation. 22 | The field cannot be left blank. 23 | 24 |

Active Time End

25 | A decimal value, in seconds, can be entered in this text field. 26 | Specify a ending time for the flux source. 27 | The field cannot be left blank. 28 | 29 |

Center of Source X

30 | A decimal value, in UTM E coordinates, can be entered in this text field. 31 | The field cannot be left blank. 32 | 33 |

Center of Source Y

34 | A decimal value, in UTM N coordinates, can be entered in this text field. 35 | The field cannot be left blank. 36 | 37 |

Major Extent

38 | A decimal value, in meters, can be entered in this text field. 39 | Required because the flux source is elliptically shaped. 40 | The field cannot be left blank. 41 | 42 |

Minor Extent

43 | A decimal value. in meters, can be entered in this text field. 44 | Required because the flux source is elliptically shaped. 45 | The field cannot be left blank. 46 | 47 |

Orientation Angle

48 | A decimal value, in degrees from X axis to major axis, can be entered in 49 | this text field. 50 | The field cannot be left blank. 51 | 52 |

Initial Speed

53 | A decimal value, in meters per second, can be entered in this text field. 54 | The initial horizontal speed (i.e. tangential to the terrain) of the material 55 | as it leaves the flux-source (the flux-source itself, remains stationary). 56 | The field cannot be left blank. 57 | 58 |

Initial Direction

59 | A decimal value, measured in degrees from the X axis, can be entered in this 60 | text field. The field cannot be left blank. 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /doc/help/html/load_save.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Help Overview 6 | 7 | 8 | 9 | 10 |

Loading and Saving a Titan Model Run

11 | 12 |

Load

13 | A pre-existing Titan run parameter set can be loaded. The directory containing 14 | the Titan parameter files can be loaded by either using the directory selector, 15 | which will be displayed by pushing the "Input Directory" button, or by typing 16 | in the fully qualified path in the text field. Once the directory has been 17 | selected, push the "Load" button to load the paramters for the Titan run. When 18 | the "Load" button is pushed, the save directory and run name fields on this tab 19 | will be updated automatically. If the "Load" button is not pushed, the 20 | selected run will not be loaded. 21 | 22 |

Save

23 | A Titan run's parameters can be saved for future use. Parameter files will 24 | be written containing the Titan parameters in a format that can be read in 25 | the future. A base directory and run name must be provided to save the 26 | Titan parameters. The base directory can be set by either using the directory 27 | selector, which will be displayed by pushing the "Base Save Directory" button, 28 | or by typing in the fully qualified path in the test field. The run name can 29 | be set by typing in the value in the Run Name text field. The run name will 30 | be appended to the base directory to produce a fully qualified path where the 31 | Titan parameter files will be saved. Once the base directory and run name have 32 | been entered, push the "Save" button to save the parameters for the Titan run. 33 | When the "Save" button is pushed, the input directory on this tab will be 34 | updated automatically. If the "Save" button is not pushed, the selected run 35 | will not be saved. 36 | 37 |

Email Address

38 | The string value can be entered in this text field. 39 | The email address to send the notification of completion for the run to. 40 | An email address is not needed if you are doing the run on a PC. 41 | If field is left blank, email will be sent to user@buffalo.edu. This feature is currently disabled. 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /doc/help/html/options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Help Overview 6 | 7 | 8 | 9 | 10 |

Options

11 | 12 |

Titan Application Version

13 | Set the Titan application binary files to use when launching a Titan model run. 14 | The setting allows the user flexibility to use Titan application files that 15 | may have been modified by the user for testing purposes. 16 | 17 |

Use External Titan Binaries

18 | When set to False, the Titan application binary files specified by the user's 19 | PATH environment variable will be used when a Titan run is launched from this 20 | interface.
21 | When set to True, the Titan application binary files at the location specified 22 | by the titan binary directory entered on this panel will be used when a Titan run 23 | is launched from this interface. 24 | 25 |

Titan Binary Directory

26 | The fully qualified path where the Titan application binary files are located. 27 | The field is not required if the use of external binaries is disabled. 28 | The value can be set by using the directory chooser, which is displayed by 29 | pushing the "Titan Binary Directory" button, or entering the directory in the 30 | text field. 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /doc/help/html/welcome.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Help Overview 6 | 7 | 8 | 9 |

The Titan Application

10 | Welcome to the Titan application. 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docker/Dockerfile_titan2d_ready_centos: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | 3 | LABEL description="image with dependencies to make titan2d" 4 | 5 | # setup entry point 6 | WORKDIR /root 7 | 8 | # install dependencies 9 | RUN \ 10 | yum -y update && \ 11 | yum -y install --setopt=tsflags=nodocs epel-release && \ 12 | yum -y install --setopt=tsflags=nodocs \ 13 | vim wget git \ 14 | gcc gcc-c++ make autoconf automake \ 15 | python python-devel swig3 \ 16 | hdf5 hdf5-devel gdal gdal-devel\ 17 | java-1.7.0-openjdk java-1.7.0-openjdk-devel \ 18 | isomd5sum time mc && \ 19 | wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ 20 | sh ./Miniconda3-latest-Linux-x86_64.sh -b && \ 21 | rm ./Miniconda3-latest-Linux-x86_64.sh && \ 22 | ~/miniconda3/bin/conda init 23 | 24 | RUN ~/miniconda3/bin/conda install -y h5py 25 | -------------------------------------------------------------------------------- /docker/titan2d_bin_maker_centos6.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:6 2 | 3 | LABEL description="image for titan2d portable binaries making" 4 | 5 | # add devtoolset for fresher compilers 6 | #RUN yum install -y centos-release-scl-rh && \ 7 | # yum install -y devtoolset-8 8 | RUN yum install -y centos-release-scl-rh && \ 9 | yum install -y devtoolset-7 devtoolset-8 devtoolset-9 10 | 11 | RUN yum install -y vim wget bzip2 xz rsync time mc \ 12 | autoconf make automake sudo git \ 13 | openssl openssl-devel openssl-static chrpath \ 14 | libpng libpng-devel \ 15 | java-1.7.0-openjdk java-1.7.0-openjdk-devel && \ 16 | yum install -y epel-release && \ 17 | yum install -y patchelf 18 | # add users 19 | RUN useradd -m -s /bin/bash centos && \ 20 | echo 'centos:centos' |chpasswd && \ 21 | usermod -a -G wheel centos && \ 22 | echo "centos ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers 23 | 24 | COPY docker/utils/titan2d_bin_maker /usr/local/bin/ 25 | 26 | WORKDIR /home/centos 27 | 28 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_miniconda" &&\ 29 | su - centos -c "/usr/local/bin/titan2d_bin_maker download_dependencies" 30 | 31 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_zlib" &&\ 32 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_hdf5" &&\ 33 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_gdal" &&\ 34 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2" &&\ 35 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_pcre" &&\ 36 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_swig" 37 | 38 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_cython" &&\ 39 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_setuptools" &&\ 40 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_numpy" &&\ 41 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_h5py" &&\ 42 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_jpeg" &&\ 43 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_freetype2" 44 | 45 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_pil" &&\ 46 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_libgd" &&\ 47 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_gnuplot" &&\ 48 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_images2gif" &&\ 49 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_java_copy_from_dist" 50 | 51 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker modify_dependencies_rpath" 52 | 53 | # setup entry point 54 | ENTRYPOINT ["/usr/local/bin/titan2d_bin_maker"] 55 | CMD ["bash_user"] -------------------------------------------------------------------------------- /docker/titan2d_bin_maker_centos7.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | 3 | LABEL description="image for titan2d portable binaries making" 4 | 5 | # add devtoolset for fresher compilers 6 | #RUN yum install -y centos-release-scl-rh && \ 7 | # yum install -y devtoolset-8 8 | RUN yum install -y centos-release-scl-rh && \ 9 | yum install -y devtoolset-7 devtoolset-8 devtoolset-9 10 | 11 | RUN yum install -y vim wget bzip2 xz rsync time mc \ 12 | autoconf automake make sudo git \ 13 | openssl openssl-devel openssl-static chrpath \ 14 | libpng libpng-devel \ 15 | yum install -y epel-release && \ 16 | yum install -y patchelf redhat-lsb-core 17 | # add users 18 | RUN useradd -m -s /bin/bash centos && \ 19 | echo 'centos:centos' |chpasswd && \ 20 | usermod -a -G wheel centos && \ 21 | echo "centos ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers 22 | 23 | COPY docker/utils/titan2d_bin_maker /usr/local/bin/ 24 | 25 | WORKDIR /home/centos 26 | 27 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_miniconda" &&\ 28 | su - centos -c "/usr/local/bin/titan2d_bin_maker download_dependencies" 29 | 30 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_zlib" &&\ 31 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_hdf5" &&\ 32 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_gdal" &&\ 33 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2" &&\ 34 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_pcre" &&\ 35 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_swig" 36 | 37 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_cython" &&\ 38 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_setuptools" &&\ 39 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_numpy" &&\ 40 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_h5py" &&\ 41 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_jpeg" &&\ 42 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_freetype2" 43 | 44 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_pil" &&\ 45 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_libgd" &&\ 46 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_gnuplot" &&\ 47 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_images2gif" &&\ 48 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_java" 49 | 50 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker modify_dependencies_rpath" 51 | 52 | # setup entry point 53 | ENTRYPOINT ["/usr/local/bin/titan2d_bin_maker"] 54 | CMD ["bash_user"] -------------------------------------------------------------------------------- /docker/titan2d_bin_maker_ubuntu18.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | LABEL description="image for titan2d portable binaries making" 4 | 5 | # add devtoolset for fresher compilers 6 | #RUN yum install -y centos-release-scl-rh && \ 7 | # yum install -y devtoolset-8 8 | RUN apt-get update && \ 9 | apt-get install -y build-essential 10 | 11 | RUN apt-get install -y vim wget bzip2 rsync time mc \ 12 | autoconf make automake sudo git \ 13 | libssl-dev chrpath \ 14 | libpng-dev patchelf pkg-config 15 | # add users 16 | RUN useradd -m -s /bin/bash centos && \ 17 | echo 'centos:centos' |chpasswd && \ 18 | usermod -a -G sudo centos && \ 19 | echo "centos ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers 20 | 21 | COPY docker/utils/titan2d_bin_maker /usr/local/bin/ 22 | 23 | WORKDIR /home/centos 24 | 25 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_miniconda" &&\ 26 | su - centos -c "/usr/local/bin/titan2d_bin_maker download_dependencies" 27 | 28 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_zlib_1_2_9" &&\ 29 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_hdf5" &&\ 30 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_gdal" &&\ 31 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_7_18" &&\ 32 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_pcre" &&\ 33 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_swig" 34 | 35 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_cython" &&\ 36 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_setuptools" &&\ 37 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_numpy1_16_6" &&\ 38 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_python2_h5py" &&\ 39 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_jpeg" &&\ 40 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_freetype2" 41 | 42 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker install_pil" &&\ 43 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_libgd" &&\ 44 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_gnuplot" &&\ 45 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_images2gif" &&\ 46 | su - centos -c "/usr/local/bin/titan2d_bin_maker install_java" 47 | 48 | RUN su - centos -c "/usr/local/bin/titan2d_bin_maker modify_dependencies_rpath" 49 | 50 | # setup entry point 51 | ENTRYPOINT ["/usr/local/bin/titan2d_bin_maker"] 52 | CMD ["bash_user"] -------------------------------------------------------------------------------- /gui/derby.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/gui/derby.jar -------------------------------------------------------------------------------- /gui/jh.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/gui/jh.jar -------------------------------------------------------------------------------- /gui/titan/graphics/IValueComponent.java: -------------------------------------------------------------------------------- 1 | package titan.graphics; 2 | 3 | import java.awt.Component; 4 | 5 | public interface IValueComponent { 6 | 7 | public Component getPanel(); 8 | 9 | public String getValue(); 10 | 11 | public void setValue(String val); 12 | } 13 | -------------------------------------------------------------------------------- /gui/titan/graphics/LabelDisplay.java: -------------------------------------------------------------------------------- 1 | package titan.graphics; 2 | 3 | import java.awt.Component; 4 | import java.awt.Dimension; 5 | import java.awt.GridLayout; 6 | 7 | import javax.swing.JLabel; 8 | import javax.swing.JPanel; 9 | 10 | public class LabelDisplay { 11 | 12 | JPanel panel; 13 | 14 | public LabelDisplay(String lbl, String val) { 15 | 16 | panel = new JPanel(new GridLayout()); 17 | 18 | 19 | //panel.setBackground(Color.RED); 20 | 21 | JLabel title = new JLabel(lbl); 22 | //title.setOpaque(true); 23 | //title.setBackground(Color.GREEN); 24 | panel.add(title); 25 | 26 | JLabel value = new JLabel(val); 27 | //value.setOpaque(true); 28 | //value.setBackground(Color.YELLOW); 29 | panel.add(value); 30 | 31 | // Do not allow height of object to be resized past 32 | // the preferred height 33 | Dimension myMaxSize = panel.getMaximumSize(); 34 | myMaxSize.height = panel.getPreferredSize().height; 35 | panel.setMaximumSize(myMaxSize); 36 | } 37 | 38 | public Component getPanel() { 39 | return panel; 40 | } 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /gui/titan/graphics/TextArea.java: -------------------------------------------------------------------------------- 1 | package titan.graphics; 2 | 3 | import java.awt.Component; 4 | import java.awt.Dimension; 5 | import java.awt.GridLayout; 6 | 7 | import javax.swing.JLabel; 8 | import javax.swing.JPanel; 9 | import javax.swing.JScrollPane; 10 | import javax.swing.JTextArea; 11 | 12 | public class TextArea implements IValueComponent { 13 | 14 | JPanel panel; 15 | JTextArea value; 16 | 17 | public TextArea(String lbl) { 18 | panel = new JPanel(new GridLayout()); 19 | 20 | JLabel title = new JLabel(lbl); 21 | panel.add(title); 22 | 23 | value = new JTextArea(); 24 | value.setRows(4); 25 | 26 | JScrollPane textPain = new JScrollPane(value); 27 | textPain.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); 28 | 29 | panel.add(textPain); 30 | 31 | // Do not allow height of object to be resized past 32 | // the preferred height 33 | Dimension myMaxSize = panel.getMaximumSize(); 34 | myMaxSize.height = panel.getPreferredSize().height; 35 | panel.setMaximumSize(myMaxSize); 36 | } 37 | 38 | public void setEditable(boolean b) { 39 | value.setEditable(b); 40 | } 41 | 42 | public Component getPanel() { 43 | return panel; 44 | } 45 | 46 | public String getValue() { 47 | return value.getText(); 48 | } 49 | 50 | public void setValue(String val) { 51 | value.setText(val); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /gui/titan/graphics/TextInput.java: -------------------------------------------------------------------------------- 1 | package titan.graphics; 2 | 3 | import java.awt.Color; 4 | import java.awt.Component; 5 | import java.awt.Dimension; 6 | import java.awt.GridLayout; 7 | 8 | import javax.swing.JLabel; 9 | import javax.swing.JPanel; 10 | import javax.swing.JTextField; 11 | 12 | public class TextInput implements IValueComponent { 13 | 14 | JPanel panel; 15 | JLabel title; 16 | JTextField value; 17 | 18 | public TextInput(String lbl) { 19 | panel = new JPanel(new GridLayout()); 20 | 21 | title = new JLabel(lbl); 22 | panel.add(title); 23 | 24 | value = new JTextField(20); 25 | panel.add(value); 26 | 27 | // Do not allow height of object to be resized past 28 | // the preferred height 29 | Dimension myMaxSize = panel.getMaximumSize(); 30 | myMaxSize.height = panel.getPreferredSize().height; 31 | panel.setMaximumSize(myMaxSize); 32 | } 33 | 34 | public void setEditable(boolean b) { 35 | value.setEditable(b); 36 | } 37 | 38 | public Component getPanel() { 39 | return panel; 40 | } 41 | 42 | public String getLabelText() { return title.getText(); } 43 | 44 | public void setLabelText(String text) { title.setText(text); } 45 | 46 | public String getValue() { 47 | return value.getText(); 48 | } 49 | 50 | public void setValue(String val) { 51 | value.setText(val); 52 | } 53 | 54 | public void setValueVisible(boolean b) { 55 | value.setVisible(b); 56 | } 57 | 58 | public void setToolTipText(String tip) { 59 | value.setToolTipText(tip); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /gui/titan/gui/DefaultTitanData.java: -------------------------------------------------------------------------------- 1 | package titan.gui; 2 | 3 | import titan.io.INameValuePair; 4 | import titan.io.NameValuePairSimple; 5 | 6 | public class DefaultTitanData { 7 | 8 | INameValuePair[] defaultData; 9 | 10 | public DefaultTitanData() { 11 | defaultData = new INameValuePair[TitanConstants.parameterKeyList.length]; 12 | for(int i = 0; i < TitanConstants.parameterKeyList.length; i++) { 13 | defaultData[i] = new NameValuePairSimple(TitanConstants.parameterKeyList[i], 14 | TitanConstants.parameterValueDefaults[i]); 15 | } 16 | 17 | } 18 | 19 | public INameValuePair[] getDefaults() { 20 | return defaultData; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /gui/titan/gui/RunStyleDialog.java: -------------------------------------------------------------------------------- 1 | package titan.gui; 2 | 3 | import javax.swing.JDialog; 4 | 5 | public class RunStyleDialog extends JDialog { 6 | 7 | RunStyleDialog() { 8 | 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /gui/titan/gui/TabDischargePlanes.java: -------------------------------------------------------------------------------- 1 | package titan.gui; 2 | 3 | import javax.swing.ListSelectionModel; 4 | 5 | public class TabDischargePlanes extends TitanTabList { 6 | 7 | public TabDischargePlanes() { 8 | super(true, ListSelectionModel.SINGLE_SELECTION); 9 | 10 | addButton.setText("Add Discharge Plane"); 11 | deleteButton.setText("Delete Discharge Plane"); 12 | 13 | String[] headings = new String[] { "Point A UTM E", 14 | "Point A UTM N", 15 | "Point B UTM E", 16 | "Point b UTM N" }; 17 | blankRow = new String[headings.length]; 18 | for(int i = 0; i < headings.length; i++) { 19 | blankRow[i] = ""; 20 | } 21 | 22 | ids = new String[] { TitanConstants.PLANE_A_E, 23 | TitanConstants.PLANE_A_N, 24 | TitanConstants.PLANE_B_E, 25 | TitanConstants.PLANE_B_N }; 26 | tm.setColumnIdentifiers(headings); 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /gui/titan/gui/TabFluxSources.java: -------------------------------------------------------------------------------- 1 | package titan.gui; 2 | 3 | import javax.swing.ListSelectionModel; 4 | 5 | public class TabFluxSources extends TitanTabList { 6 | 7 | public TabFluxSources() { 8 | super(true, ListSelectionModel.SINGLE_SELECTION); 9 | 10 | addButton.setText("Add Flux Source"); 11 | deleteButton.setText("Delete Flux Source"); 12 | 13 | String[] headings = new String[] { "Extrusion Rate", 14 | "Active Time Start", 15 | "Active Time End", 16 | "Center of Source X", 17 | "Center of Source Y", 18 | "Major Extent", 19 | "Minor Extent", 20 | "Orientation Angle", 21 | "Init Speed", 22 | "Init Direction" }; 23 | 24 | blankRow = new String[headings.length]; 25 | for(int i = 0; i < headings.length; i++) { 26 | blankRow[i] = ""; 27 | } 28 | 29 | ids = new String[] { TitanConstants.SRC_EXTRUSION_FLUX_RATE, 30 | TitanConstants.SRC_ACTIVE_TIME_START, 31 | TitanConstants.SRC_ACTIVE_TIME_END, 32 | TitanConstants.SRC_CENTER_XC, 33 | TitanConstants.SRC_CENTER_YC, 34 | TitanConstants.SRC_MAJOR_EXTENT, 35 | TitanConstants.SRC_MINOR_EXTENT, 36 | TitanConstants.SRC_ORIENTATION_ANGLE, 37 | TitanConstants.SRC_INIT_SPEED, 38 | TitanConstants.SRC_INIT_DIRECTION }; 39 | tm.setColumnIdentifiers(headings); 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /gui/titan/gui/TitanTab.java: -------------------------------------------------------------------------------- 1 | package titan.gui; 2 | 3 | import java.awt.Component; 4 | import java.awt.Dimension; 5 | 6 | import javax.swing.Box; 7 | import javax.swing.JPanel; 8 | 9 | import titan.io.INameValuePair; 10 | 11 | 12 | public abstract class TitanTab extends JPanel { 13 | 14 | protected INameValuePair[] values; 15 | 16 | public INameValuePair[] getData() { 17 | return values; 18 | } 19 | 20 | public void setData(INameValuePair[] data) { 21 | try { 22 | for(int i = 0; i < data.length; i++) { 23 | for(int j = 0; j < values.length; j++) { 24 | if(data[i].getName().compareTo(values[j].getName()) == 0) { 25 | values[j].setValue(data[i].getValue()); 26 | break; 27 | } 28 | } 29 | } 30 | } catch (Exception ee) { 31 | // This will occur when the number of allowable fields for a parameter has decreased. 32 | } 33 | } 34 | 35 | public String getValue(String key) { 36 | String value = null; 37 | for(int i = 0; i < values.length; i++) { 38 | if(values[i].getName() == key) { 39 | value = new String(values[i].getValue()); 40 | break; 41 | } 42 | } 43 | return value; 44 | } 45 | 46 | public Component add(Component comp) { 47 | Component c = super.add(comp); 48 | super.add(Box.createRigidArea(new Dimension(0,5))); 49 | return c; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /gui/titan/io/GenericReader.java: -------------------------------------------------------------------------------- 1 | package titan.io; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.IOException; 6 | 7 | public class GenericReader extends InputReader { 8 | 9 | public GenericReader(File inputFile) throws FileNotFoundException { 10 | super(inputFile); 11 | } 12 | 13 | public String read() { 14 | String contents = new String(""); 15 | String line; 16 | try { 17 | while((line = stream.readLine()) != null) { 18 | contents = contents.concat(line + "\n"); 19 | } 20 | } 21 | catch (IOException e) { } 22 | 23 | return contents; 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /gui/titan/io/INameValuePair.java: -------------------------------------------------------------------------------- 1 | package titan.io; 2 | 3 | public interface INameValuePair { 4 | 5 | public String getName(); 6 | 7 | public String getValue(); 8 | 9 | public void setValue(String v); 10 | } 11 | -------------------------------------------------------------------------------- /gui/titan/io/InputReader.java: -------------------------------------------------------------------------------- 1 | package titan.io; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.FileNotFoundException; 6 | import java.io.FileReader; 7 | import java.io.IOException; 8 | 9 | import javax.swing.JOptionPane; 10 | 11 | public abstract class InputReader { 12 | 13 | BufferedReader stream; 14 | 15 | public InputReader(File inputFile) throws FileNotFoundException { 16 | // try { 17 | stream = new BufferedReader(new FileReader(inputFile)); 18 | // } 19 | // catch (FileNotFoundException e) { 20 | // throw(e); 21 | // } 22 | } 23 | 24 | protected String removeSurroundingWhitespace(String str) { 25 | // Remove leading white space 26 | str = str.replaceAll("\\s+", ""); 27 | // Remove trailing whitespace 28 | str = str.replaceAll("\\s+$", ""); 29 | return str; 30 | } 31 | 32 | public void close() { 33 | try { 34 | stream.close(); 35 | } 36 | catch (IOException e) { 37 | System.out.println("Problem Closing stream."); 38 | e.printStackTrace(); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /gui/titan/io/NameValuePairComponent.java: -------------------------------------------------------------------------------- 1 | package titan.io; 2 | 3 | import titan.graphics.IValueComponent; 4 | 5 | public class NameValuePairComponent implements INameValuePair { 6 | 7 | private String name; 8 | private IValueComponent value; 9 | 10 | public NameValuePairComponent(String n, IValueComponent obj) { 11 | name = new String(n); 12 | value = obj; 13 | } 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | 19 | public String getValue() { 20 | return value.getValue(); 21 | } 22 | 23 | public void setValue(String v) { 24 | value.setValue(v); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /gui/titan/io/NameValuePairGroup.java: -------------------------------------------------------------------------------- 1 | package titan.io; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class NameValuePairGroup { 6 | 7 | ArrayList myData; 8 | 9 | public NameValuePairGroup() { 10 | myData = new ArrayList(); 11 | } 12 | 13 | public void addNameValuePair(INameValuePair nvp) { 14 | myData.add(nvp); 15 | } 16 | 17 | public void addNameValuePair(INameValuePair[] nvp) { 18 | for(int i = 0; i < nvp.length; i++) { 19 | myData.add(nvp[i]); 20 | } 21 | } 22 | 23 | public String getValue(String key) { 24 | //System.out.println(" nvp len : " + myData.size()); 25 | for(int i = 0; i < myData.size(); i++) { 26 | //System.out.println(" key : " + ((INameValuePair)myData.get(i)).getName()); 27 | if(((INameValuePair)myData.get(i)).getName().compareTo(key) == 0) { 28 | return ((INameValuePair)myData.get(i)).getValue(); 29 | } 30 | } 31 | return null; 32 | } 33 | 34 | /** 35 | * Changes the value of a name value pair held by the group. 36 | * If the key does not exist in the group, no action is taken. 37 | * @param key 38 | * @param value 39 | */ 40 | public void setValue(String key, String value) { 41 | for(int i = 0; i < myData.size(); i++) { 42 | if((myData.get(i)).getName().compareTo(key) == 0) { 43 | myData.get(i).setValue(value); 44 | break; 45 | } 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /gui/titan/io/NameValuePairSimple.java: -------------------------------------------------------------------------------- 1 | package titan.io; 2 | 3 | import titan.graphics.IValueComponent; 4 | 5 | public class NameValuePairSimple implements INameValuePair { 6 | 7 | private String name; 8 | private String value; 9 | 10 | public NameValuePairSimple(String n, String c) { 11 | name = new String(n); 12 | value = new String(c); 13 | } 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | 19 | public String getValue() { 20 | return value; 21 | } 22 | 23 | public void setValue(String v) { 24 | value = new String(v); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /gui/titan/io/OutputWriter.java: -------------------------------------------------------------------------------- 1 | package titan.io; 2 | 3 | import java.io.BufferedWriter; 4 | import java.io.File; 5 | import java.io.FileWriter; 6 | import java.io.IOException; 7 | 8 | public abstract class OutputWriter { 9 | 10 | BufferedWriter stream; 11 | 12 | public OutputWriter(File outputFile) { 13 | try { 14 | stream = new BufferedWriter(new FileWriter(outputFile)); 15 | } 16 | catch (IOException e) { 17 | System.out.println("Problem with Output File : " + outputFile.getName()); 18 | e.printStackTrace(); 19 | } 20 | } 21 | 22 | public void close() { 23 | 24 | try { 25 | stream.close(); 26 | } 27 | catch (IOException e) { 28 | System.out.println("Problem Closing stream."); 29 | e.printStackTrace(); 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /gui/titan/io/ParameterInput.java: -------------------------------------------------------------------------------- 1 | package titan.io; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.IOException; 6 | import java.util.ArrayList; 7 | 8 | public class ParameterInput extends InputReader { 9 | 10 | public ParameterInput(File inputFile) throws FileNotFoundException { 11 | super(inputFile); 12 | } 13 | 14 | public INameValuePair[] readData() { 15 | String input; 16 | ArrayList nvpList = new ArrayList(); 17 | try { 18 | while((input = stream.readLine()) != null) { 19 | removeSurroundingWhitespace(input); 20 | int equalIndex = input.indexOf("="); 21 | if(equalIndex != -1) { 22 | String name = removeSurroundingWhitespace(input.substring(0, equalIndex)); 23 | String value = removeSurroundingWhitespace(input.substring(equalIndex+1, input.length())); 24 | nvpList.add(new NameValuePairSimple(name, value)); 25 | } 26 | 27 | } 28 | } 29 | catch (IOException e) {} 30 | 31 | // Would rather typecast here, but not sure if I can 32 | INameValuePair[] nvp = new NameValuePairSimple[nvpList.size()]; 33 | for(int i = 0; i < nvpList.size(); i++) { 34 | nvp[i] = (INameValuePair)(nvpList.get(i)); 35 | } 36 | 37 | return nvp; 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /gui/titan/io/ParameterListInput.java: -------------------------------------------------------------------------------- 1 | package titan.io; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.IOException; 6 | import java.util.ArrayList; 7 | 8 | public class ParameterListInput extends InputReader { 9 | 10 | public ParameterListInput(File inputFile) throws FileNotFoundException { 11 | super(inputFile); 12 | } 13 | 14 | public INameValuePair[][] readData() { 15 | String input; 16 | int maxNumParms = 0; 17 | int numParms = 0; 18 | int equalIndex; 19 | ArrayList list = new ArrayList(); 20 | ArrayList nvpList = null; 21 | 22 | try { 23 | while((input = stream.readLine()) != null) { 24 | removeSurroundingWhitespace(input); 25 | if(input.indexOf("/=") != -1) { 26 | nvpList = new ArrayList(); 27 | list.add(nvpList); 28 | numParms = 0; 29 | } 30 | else if((equalIndex = input.indexOf("=")) != -1) { 31 | String name = removeSurroundingWhitespace(input.substring(0, equalIndex)); 32 | String value = removeSurroundingWhitespace(input.substring(equalIndex+1, input.length())); 33 | nvpList.add(new NameValuePairSimple(name, value)); 34 | numParms++; 35 | if(numParms > maxNumParms) { 36 | maxNumParms = numParms; 37 | } 38 | } 39 | } 40 | } 41 | catch (IOException e) {} 42 | 43 | // Would rather typecast here, but not sure if I can 44 | INameValuePair[][] nvp = new NameValuePairSimple[list.size()][maxNumParms]; 45 | for(int i = 0; i < list.size(); i++) { 46 | ArrayList al = (ArrayList)(list.get(i)); 47 | for(int j = 0; j < al.size(); j++) { 48 | nvp[i][j] = (INameValuePair)(al.get(j)); 49 | } 50 | } 51 | 52 | return nvp; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /gui/titan/io/ParameterListOutput.java: -------------------------------------------------------------------------------- 1 | package titan.io; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | public class ParameterListOutput extends OutputWriter { 7 | 8 | public ParameterListOutput(File outputFile) { 9 | super(outputFile); 10 | } 11 | 12 | public void writeData(INameValuePair[][] data) { 13 | String output; 14 | try { 15 | for(int i = 0; i < data.length; i++) { 16 | output = new String("/=" + i + "\n"); 17 | stream.write(output); 18 | for(int j = 0; j < data[i].length; j++) { 19 | output = new String(data[i][j].getName() + "=" + data[i][j].getValue() + "\n"); 20 | stream.write(output); 21 | } 22 | } 23 | } 24 | catch(IOException e) { } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /gui/titan/io/ParameterOutput.java: -------------------------------------------------------------------------------- 1 | package titan.io; 2 | 3 | import java.io.BufferedWriter; 4 | import java.io.File; 5 | import java.io.IOException; 6 | 7 | public class ParameterOutput extends OutputWriter { 8 | 9 | public ParameterOutput(File outputFile) { 10 | super(outputFile); 11 | } 12 | 13 | public void writeData(INameValuePair[] data) { 14 | String output; 15 | for(int i = 0; i < data.length; i++) { 16 | output = new String(data[i].getName() + "=" + data[i].getValue() + "\n"); 17 | try { 18 | stream.write(output); 19 | } 20 | catch(IOException e) {} 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /gui/titan/jobs/JobDetails.java: -------------------------------------------------------------------------------- 1 | package titan.jobs; 2 | 3 | import java.util.Calendar; 4 | import java.lang.Process; 5 | 6 | public class JobDetails { 7 | 8 | public String jobName; 9 | public String jobID; 10 | public String errorMessage; 11 | public String outputDirectory; 12 | public Calendar submissionDate = Calendar.getInstance(); 13 | public Process process; 14 | 15 | public void setJobName(String jn) { 16 | jobName = new String(jn); 17 | } 18 | 19 | public String getJobName() { 20 | return jobName; 21 | } 22 | 23 | public void setJobID(String jid) { 24 | jobID = new String(jid); 25 | } 26 | 27 | public String getJobID() { 28 | return jobID; 29 | } 30 | 31 | public void setProcess(Process pro) { 32 | process = pro; 33 | } 34 | 35 | public Process getProcess() { 36 | return process; 37 | } 38 | 39 | public void setErrorMessage(String err) { 40 | errorMessage = new String(err); 41 | } 42 | 43 | public String getErrorMessage() { 44 | return errorMessage; 45 | } 46 | 47 | public void setSubmissionDate(Calendar c) { 48 | submissionDate = c; 49 | } 50 | 51 | public Calendar getSubmissionDate() { 52 | return submissionDate; 53 | } 54 | 55 | public void setOutputDirectory(String dir) { 56 | outputDirectory = new String(dir); 57 | } 58 | 59 | public String getOutputDirectory() { 60 | return outputDirectory; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /gui/titan/jobs/JobStatus.java: -------------------------------------------------------------------------------- 1 | package titan.jobs; 2 | 3 | import java.io.File; 4 | 5 | public abstract class JobStatus { 6 | 7 | public static final String STATUS_UNKNOWN = "UNKNOWN"; 8 | public static final String STATUS_RUNNING = "Running"; 9 | public static final String STATUS_EXITING = "Exiting"; 10 | public static final String STATUS_HELD = "Held"; 11 | public static final String STATUS_QUEUED = "Queued"; 12 | public static final String STATUS_MOVING = "Being Moved"; 13 | public static final String STATUS_WAITING = "Waiting"; 14 | public static final String STATUS_SUSPENDED = "Suspended"; 15 | public static final String STATUS_COMPLETED = "Completed"; 16 | public static final String STATUS_UNEXPANDED = "Unexpanded"; 17 | public static final String STATUS_REMOVED = "Removed"; 18 | //public static final String STATUS_PREPROCESS_FAIL = "Preprocess Failed"; 19 | //public static final String STATUS_VECDATA_FAIL = "Vecdata Failed"; 20 | public static final String STATUS_TITAN_FAIL = "Titan Failed"; 21 | public static final String STATUS_SUCCESS = "Successful"; 22 | 23 | /** 24 | * 25 | * @param outputDir The output directory for the run on the original host 26 | * @return Returns true if the output directory can be found and the 27 | * file .complete exists in that directory 28 | */ 29 | protected static String jobStatusFromScript(String outputDir) { 30 | String status = STATUS_UNKNOWN; 31 | if(new File(outputDir).exists()) { 32 | //if(new File(outputDir + File.separator + RunMethod.PREPROCESS_FAILED).exists()) { 33 | // status = STATUS_PREPROCESS_FAIL; 34 | //} 35 | //else if(new File(outputDir + File.separator + RunMethod.VECDATA_FAILED).exists()) { 36 | // status = STATUS_VECDATA_FAIL; 37 | //} 38 | if(new File(outputDir + File.separator + RunMethod.TITAN_FAILED).exists()) { 39 | status = STATUS_TITAN_FAIL; 40 | } 41 | else if(new File(outputDir + File.separator + RunMethod.TITAN_SUCCESSFUL).exists()) { 42 | status = STATUS_SUCCESS; 43 | } 44 | // Job is probably running, but not really sure 45 | else { 46 | status = STATUS_UNKNOWN; 47 | } 48 | } 49 | return status; 50 | } 51 | 52 | public static String getJobStatus(String jobID, String outputDir) { return STATUS_UNKNOWN; } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /gui/titan/jobs/JobStatusProcessor.java: -------------------------------------------------------------------------------- 1 | package titan.jobs; 2 | 3 | import java.util.ArrayList; 4 | 5 | public abstract class JobStatusProcessor { 6 | 7 | protected String removeEdgeWhitespace(String line) { 8 | String removed = line.replaceAll("^\\s+", ""); 9 | removed = removed.replaceAll("\\s+$", ""); 10 | return removed; 11 | } 12 | 13 | /** 14 | * Breaks the given string down into individual strings that are separated 15 | * by a blank space. 16 | * @param line 17 | * @return 18 | */ 19 | protected String[] parseBlankSeparatedList(String line) { 20 | ArrayList myList = new ArrayList(); 21 | 22 | String myLine = new String(line); 23 | 24 | while(myLine.contains(" ")) { 25 | String item = myLine.substring(0, myLine.indexOf(" ")); 26 | myList.add(item); 27 | myLine = myLine.substring((myLine.indexOf(" ") + 1)); 28 | myLine = removeEdgeWhitespace(myLine); 29 | } 30 | myLine = removeEdgeWhitespace(myLine); 31 | myList.add(myLine); 32 | 33 | String[] list = new String[myList.size()]; 34 | for(int i = 0; i < myList.size(); i++) { 35 | list[i] = new String((String)myList.get(i)); 36 | } 37 | 38 | return list; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /gui/titan/jobs/JobSubmissionParameters.java: -------------------------------------------------------------------------------- 1 | package titan.jobs; 2 | 3 | import titan.io.NameValuePairGroup; 4 | import titan.io.NameValuePairSimple; 5 | 6 | 7 | public class JobSubmissionParameters { 8 | 9 | public static final String QUEUE = "queue"; 10 | public static final String MAX_RUN_TIME = "max_run_time"; 11 | public static final String NODES = "nodes"; 12 | public static final String CPUS = "cpus"; 13 | public static final String NODES_SUBMIT = "nodes_submit"; 14 | public static final String CPUS_SUBMIT = "cpus_submit"; 15 | public static final String MAX_RUN_TIME_SUBMIT = "max_run_time_submit"; 16 | public static final String REQUIREMENTS = "reqts"; 17 | public static final String RUN_MODE = "run_mode"; 18 | public static final String RUN_ARGS = "run_args"; 19 | //use this for a flag telling if the output of the job should go into irods 20 | public static final String OUTPUT_IRODS = "output_irods"; 21 | public static final String DATE = "date"; 22 | public static final String SAVE_DIR = "save_dir"; 23 | 24 | protected NameValuePairGroup jobParms; 25 | 26 | public JobSubmissionParameters() { 27 | jobParms = new NameValuePairGroup(); 28 | } 29 | 30 | public void addJobParameter(String key, String value) { 31 | NameValuePairSimple nvps = new NameValuePairSimple(key, value); 32 | jobParms.addNameValuePair(nvps); 33 | } 34 | 35 | public String getJobParameter(String key) { 36 | return jobParms.getValue(key); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /gui/titan/jobs/condor/CondorHistoryProcessor.java: -------------------------------------------------------------------------------- 1 | package titan.jobs.condor; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.util.ArrayList; 7 | 8 | public class CondorHistoryProcessor extends CondorJobStatusProcessor { 9 | 10 | private static final int MY_ARG_LEN = 8; 11 | 12 | public CondorQData[] getJobs() { 13 | CondorQData[] jobData = null; 14 | try { 15 | Process titanJob = Runtime.getRuntime().exec("condor_history"); 16 | BufferedReader rs = new BufferedReader(new InputStreamReader(titanJob.getInputStream())); 17 | String line; 18 | ArrayList jobArray = new ArrayList(); 19 | while((line = rs.readLine()) != null) { 20 | line = removeEdgeWhitespace(line); 21 | if(parseBlankSeparatedList(line).length == MY_ARG_LEN) 22 | jobArray.add(line); 23 | } 24 | 25 | jobData = new CondorQData[jobArray.size()]; 26 | for(int job = 0; job < jobArray.size(); job++) { 27 | jobData[job] = new CondorQData(); 28 | String[] items = parseBlankSeparatedList(jobArray.get(job)); 29 | if(items.length == MY_ARG_LEN) { 30 | for(int i = 0; i < items.length; i++) 31 | items[i] = removeEdgeWhitespace(items[i]); 32 | jobData[job].jobID = items[0]; 33 | jobData[job].user = items[1]; 34 | jobData[job].useTime = items[4]; 35 | jobData[job].status = items[5].charAt(0); 36 | } 37 | } 38 | 39 | } 40 | catch (IOException ex) { ex.printStackTrace(); } 41 | 42 | return jobData; 43 | } 44 | 45 | public CondorQData getJob(String jobID) { 46 | CondorQData jobData = null; 47 | try { 48 | Process titanJob = Runtime.getRuntime().exec("condor_history " + jobID); 49 | BufferedReader rs = new BufferedReader(new InputStreamReader(titanJob.getInputStream())); 50 | String line; 51 | ArrayList jobArray = new ArrayList(); 52 | while((line = rs.readLine()) != null) { 53 | line = removeEdgeWhitespace(line); 54 | if(parseBlankSeparatedList(line).length == MY_ARG_LEN) 55 | jobArray.add(line); 56 | } 57 | 58 | if(jobArray.size() == 1) { 59 | jobData = new CondorQData(); 60 | String[] items = parseBlankSeparatedList(jobArray.get(0)); 61 | if(items.length == MY_ARG_LEN) { 62 | for(int i = 0; i < items.length; i++) 63 | items[i] = removeEdgeWhitespace(items[i]); 64 | jobData.jobID = items[0]; 65 | jobData.user = items[1]; 66 | jobData.useTime = items[4]; 67 | jobData.status = items[5].charAt(0); 68 | } 69 | } 70 | 71 | } 72 | catch (IOException ex) { ex.printStackTrace(); } 73 | 74 | return jobData; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /gui/titan/jobs/condor/CondorJobStatusProcessor.java: -------------------------------------------------------------------------------- 1 | package titan.jobs.condor; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.util.ArrayList; 7 | 8 | import titan.jobs.JobStatusProcessor; 9 | 10 | public abstract class CondorJobStatusProcessor extends JobStatusProcessor { 11 | 12 | 13 | 14 | public class CondorQData { 15 | public String jobID; 16 | public String user; 17 | public String useTime; 18 | public char status; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /gui/titan/jobs/condor/CondorQProcessor.java: -------------------------------------------------------------------------------- 1 | package titan.jobs.condor; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | import java.util.ArrayList; 7 | 8 | 9 | public class CondorQProcessor extends CondorJobStatusProcessor { 10 | 11 | private static final int MY_ARG_LEN = 9; 12 | 13 | public CondorQData[] getJobs() { 14 | CondorQData[] jobData = null; 15 | try { 16 | Process titanJob = Runtime.getRuntime().exec("condor_q -global"); 17 | BufferedReader rs = new BufferedReader(new InputStreamReader(titanJob.getInputStream())); 18 | String line; 19 | ArrayList jobArray = new ArrayList(); 20 | while((line = rs.readLine()) != null) { 21 | line = removeEdgeWhitespace(line); 22 | if(parseBlankSeparatedList(line).length == MY_ARG_LEN) 23 | jobArray.add(line); 24 | } 25 | 26 | jobData = new CondorQData[jobArray.size()]; 27 | for(int job = 0; job < jobArray.size(); job++) { 28 | jobData[job] = new CondorQData(); 29 | String[] items = parseBlankSeparatedList(jobArray.get(job)); 30 | if(items.length == MY_ARG_LEN) { 31 | for(int i = 0; i < items.length; i++) 32 | items[i] = removeEdgeWhitespace(items[i]); 33 | jobData[job].jobID = items[0]; 34 | jobData[job].user = items[1]; 35 | jobData[job].useTime = items[4]; 36 | jobData[job].status = items[5].charAt(0); 37 | } 38 | } 39 | 40 | } 41 | catch (IOException ex) { ex.printStackTrace(); } 42 | 43 | return jobData; 44 | } 45 | 46 | public CondorQData getJob(String jobID) { 47 | CondorQData jobData = null; 48 | try { 49 | Process titanJob = Runtime.getRuntime().exec("condor_q -global " + jobID); 50 | BufferedReader rs = new BufferedReader(new InputStreamReader(titanJob.getInputStream())); 51 | String line; 52 | ArrayList jobArray = new ArrayList(); 53 | while((line = rs.readLine()) != null) { 54 | line = removeEdgeWhitespace(line); 55 | if(parseBlankSeparatedList(line).length == MY_ARG_LEN) 56 | jobArray.add(line); 57 | } 58 | 59 | if(jobArray.size() == 1) { 60 | jobData = new CondorQData(); 61 | 62 | String[] items = parseBlankSeparatedList(jobArray.get(0)); 63 | if(items.length == MY_ARG_LEN) { 64 | for(int i = 0; i < items.length; i++) 65 | items[i] = removeEdgeWhitespace(items[i]); 66 | jobData.jobID = items[0]; 67 | jobData.user = items[1]; 68 | jobData.useTime = items[4]; 69 | jobData.status = items[5].charAt(0); 70 | } 71 | } 72 | 73 | } 74 | catch (IOException ex) { ex.printStackTrace(); } 75 | 76 | return jobData; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /gui/titan/jobs/condor/JobStatusCondor.java: -------------------------------------------------------------------------------- 1 | package titan.jobs.condor; 2 | 3 | import titan.jobs.JobStatus; 4 | import titan.jobs.condor.CondorJobStatusProcessor.CondorQData; 5 | 6 | public class JobStatusCondor extends JobStatus { 7 | 8 | public static String getJobStatus(String jobID, String outputDir) { 9 | String status = STATUS_UNKNOWN; 10 | 11 | // Check condor_q for job 12 | CondorQProcessor condorQ = new CondorQProcessor(); 13 | CondorQData jobData = condorQ.getJob(jobID); 14 | boolean jobFound = false; 15 | if(jobData != null) { 16 | if(jobData.jobID.startsWith(jobID)) { 17 | status = convertStatus(jobData.status); 18 | jobFound = true; 19 | } 20 | } 21 | 22 | // Check condor_history for job 23 | if(!jobFound) { 24 | CondorHistoryProcessor condorHistory = new CondorHistoryProcessor(); 25 | CondorQData jobHistory = condorHistory.getJob(jobID); 26 | if(jobHistory != null) { 27 | if(jobHistory.jobID.startsWith(jobID)) { 28 | status = convertStatus(jobHistory.status); 29 | jobFound = true; 30 | } 31 | } 32 | } 33 | 34 | // If the job is not running (on this host) see if the 35 | // job is complete 36 | if(!jobFound) { 37 | status = jobStatusFromScript(outputDir); 38 | } 39 | return status; 40 | } 41 | 42 | private static String convertStatus(char inStatus) { 43 | String status = STATUS_UNKNOWN; 44 | if(inStatus == 'U') 45 | status = STATUS_UNEXPANDED; 46 | else if(inStatus == 'H') 47 | status = STATUS_HELD; 48 | else if(inStatus == 'R') 49 | status = STATUS_RUNNING; 50 | else if(inStatus == 'I') 51 | status = STATUS_QUEUED; 52 | else if(inStatus == 'C') 53 | status = STATUS_COMPLETED; 54 | else if(inStatus == 'X') 55 | status = STATUS_REMOVED; 56 | 57 | return status; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /gui/titan/jobs/local/JobStatusLocal.java: -------------------------------------------------------------------------------- 1 | package titan.jobs.local; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | 7 | import titan.jobs.JobStatus; 8 | 9 | public class JobStatusLocal extends JobStatus { 10 | 11 | public static String getJobStatus(String jobID, String outputDir) { 12 | String status = STATUS_UNKNOWN; 13 | try { 14 | 15 | Process psJob = Runtime.getRuntime().exec("ps -u"); 16 | 17 | BufferedReader rs = new BufferedReader(new InputStreamReader(psJob.getInputStream())); 18 | 19 | String line; 20 | boolean jobFound = false; 21 | while((line = rs.readLine()) != null) { 22 | line = line.substring(line.indexOf(" ") + 1); 23 | while(line.startsWith(" ")) line = line.substring(1); 24 | line = line.substring(0, line.indexOf(" ")); 25 | if(line.compareTo(jobID) == 0) { 26 | status = STATUS_RUNNING; 27 | jobFound = true; 28 | } 29 | } 30 | // If the job is not running (on this host) see if the 31 | // job is complete 32 | if(!jobFound) { 33 | status = jobStatusFromScript(outputDir); 34 | } 35 | 36 | } 37 | catch (IOException ex) { ex.printStackTrace(); } 38 | return status; 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /gui/titan/jobs/pbs/JobStatusPBS.java: -------------------------------------------------------------------------------- 1 | package titan.jobs.pbs; 2 | 3 | import titan.jobs.JobStatus; 4 | import titan.jobs.pbs.QstatProcessor.QstatData; 5 | 6 | public class JobStatusPBS extends JobStatus { 7 | 8 | public static String getJobStatus(String jobID, String outputDir) { 9 | String status = STATUS_UNKNOWN; 10 | QstatProcessor qstat = new QstatProcessor(); 11 | QstatData jobData = qstat.getJob(jobID); 12 | boolean jobFound = false; 13 | if(jobData != null) { 14 | if(jobID.startsWith(jobData.jobID)) { 15 | if(jobData.status == 'E') 16 | status = STATUS_EXITING; 17 | else if(jobData.status == 'H') 18 | status = STATUS_HELD; 19 | else if(jobData.status == 'Q') 20 | status = STATUS_QUEUED; 21 | else if(jobData.status == 'R') 22 | status = STATUS_RUNNING; 23 | else if(jobData.status == 'T') 24 | status = STATUS_MOVING; 25 | else if(jobData.status == 'W') 26 | status = STATUS_WAITING; 27 | else if(jobData.status == 'S') 28 | status = STATUS_SUSPENDED; 29 | jobFound = true; 30 | } 31 | } 32 | // If the job is not running (on this host) see if the 33 | // job is complete 34 | if(!jobFound) { 35 | status = jobStatusFromScript(outputDir); 36 | } 37 | return status; 38 | } 39 | 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /gui/titan/jobs/submit/JobStatusSubmit.java: -------------------------------------------------------------------------------- 1 | package titan.jobs.submit; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStreamReader; 6 | 7 | import titan.jobs.JobStatus; 8 | 9 | public class JobStatusSubmit extends JobStatus { 10 | 11 | public static String getJobStatus(String jobID, String outputDir) { 12 | String status = STATUS_UNKNOWN; 13 | try { 14 | 15 | Process psJob = Runtime.getRuntime().exec("ps -u"); 16 | 17 | BufferedReader rs = new BufferedReader(new InputStreamReader(psJob.getInputStream())); 18 | 19 | String line; 20 | boolean jobFound = false; 21 | while((line = rs.readLine()) != null) { 22 | line = line.substring(line.indexOf(" ") + 1); 23 | while(line.startsWith(" ")) line = line.substring(1); 24 | line = line.substring(0, line.indexOf(" ")); 25 | if(line.compareTo(jobID) == 0) { 26 | status = STATUS_RUNNING; 27 | jobFound = true; 28 | } 29 | } 30 | // If the job is not running (on this host) see if the 31 | // job is complete 32 | if(!jobFound) { 33 | status = jobStatusFromScript(outputDir); 34 | } 35 | 36 | } 37 | catch (IOException ex) { ex.printStackTrace(); } 38 | return status; 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /gui/titan/options/OptionsManager.java: -------------------------------------------------------------------------------- 1 | package titan.options; 2 | 3 | import titan.gui.TitanConstants; 4 | import titan.io.NameValuePairGroup; 5 | import titan.io.NameValuePairSimple; 6 | 7 | public class OptionsManager { 8 | 9 | private NameValuePairGroup myValues; 10 | public static final String TITAN_BINARY_MODE = "TITAN_BINARY_MODE"; 11 | public static final String TITAN_BINARY_DIR = "TITAN_BINARY_DIR"; 12 | 13 | public OptionsManager() { 14 | myValues = new NameValuePairGroup(); 15 | myValues.addNameValuePair(new NameValuePairSimple[] { 16 | new NameValuePairSimple(TITAN_BINARY_MODE, TitanConstants.FALSE), 17 | new NameValuePairSimple(TITAN_BINARY_DIR, "")}); 18 | } 19 | 20 | public void setBinaryMode(boolean mode) { 21 | if(mode == true) 22 | myValues.setValue(TITAN_BINARY_MODE, TitanConstants.TRUE); 23 | else 24 | myValues.setValue(TITAN_BINARY_MODE, TitanConstants.FALSE); 25 | } 26 | 27 | public boolean getBinaryMode() { 28 | return Boolean.parseBoolean(myValues.getValue(TITAN_BINARY_MODE)); 29 | } 30 | 31 | public void setBinaryDirectory(String dir) { 32 | myValues.setValue(TITAN_BINARY_DIR, dir); 33 | } 34 | 35 | public String getBinaryDirectory() { 36 | return myValues.getValue(TITAN_BINARY_DIR); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /gui/titan_gui.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script to start the Titan2D GUI. Enter: titan_gui.sh 4 | 5 | # The location of the Titan2D application binary must be included in the PATH environment variable. 6 | # (Note: On VHub, the location of the Titan application binary is set via HUBzero invoke processing when the Titan2D tool GUI is launched). Examples: 7 | # VHub: 8 | # use titan2d-v4.0.0 9 | # rush: 10 | # module load titan 11 | # otherwise: 12 | # Add the path to the Titan2D application binary to the PATH environment variable. 13 | # Example, in your .bashrc file: 14 | # export PATH=$PATH:"/projects/academic/gmfg/renettej/titan2d_github/titan2d/bin" 15 | 16 | TITAN2D_HOME="$(readlink -f ${BASH_SOURCE})" 17 | TITAN2D_HOME=$(dirname "$TITAN2D_HOME") 18 | export TITAN2D_HOME=$(dirname "$TITAN2D_HOME") 19 | echo TITAN2D_HOME $TITAN2D_HOME 20 | 21 | export TITAN2D_ON_VHUB=@TITAN2D_ON_VHUB@ 22 | 23 | if [ "@TITAN2D_PORTABLE@" = "yes" ] 24 | then 25 | #PATHS for portable version 26 | export PATH=$TITAN2D_HOME/lib/titan2d_dep/bin:$PATH 27 | JAVA_TO_USE=$TITAN2D_HOME/lib/titan2d_dep/lib/java-1.7/bin/java 28 | elif [ "@TITAN2D_DEP@" != "no" ] 29 | then 30 | #PATHS for titan with titan_dep 31 | export PATH="@TITAN2D_DEP@/bin:$PATH" 32 | JAVA_TO_USE=@TITAN2D_DEP@/lib/java-1.7/bin/java 33 | else 34 | #PATHS for titan with user specified dependencies 35 | export PATH=@HDF5_PATH@/bin:$PATH 36 | export LD_LIBRARY_PATH=@HDF5_PATH@/lib:$LD_LIBRARY_PATH 37 | JAVA_TO_USE=@JAVA@ 38 | fi 39 | 40 | # Specify the start directory for the Titan2D GUI's directory selectors. 41 | # Default, $Home 42 | # Example: 43 | # export TITAN2D_INPUTDIR="/projects/academic/gmfg/renettej/titan_java_gui_input" 44 | 45 | 46 | 47 | #load titan2d environment variables 48 | source "$TITAN2D_HOME/bin/titanvars.sh" 49 | echo TITAN2D_HOME $TITAN2D_HOME 50 | 51 | export PATH="$TITAN2D_HOME/bin:$PATH" 52 | 53 | libpath="$TITAN2D_HOME/lib/titan_java_gui" 54 | 55 | # Help files are installed to $(docdir) 56 | helppath="$TITAN2D_HOME/share/doc/titan2d" 57 | 58 | 59 | 60 | export CLASSPATH=$libpath/titan_gui.jar:$libpath/jh.jar:$libpath/derby.jar:$helppath:${CLASSPATH} 61 | 62 | $JAVA_TO_USE titan.gui.Titan 63 | -------------------------------------------------------------------------------- /scripts/FreeSerif.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/scripts/FreeSerif.ttf -------------------------------------------------------------------------------- /scripts/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for scripts/ directory 3 | # 4 | 5 | 6 | 7 | bin_SCRIPTS = driverKML.sh driverMultiProcessor.sh 8 | 9 | pyfilesdir=$(pythondir) 10 | pyfiles_PYTHON = \ 11 | createVolcanoKML_POLYGONS_ANIMATION.py createVolcanoKML_POLYGONS_LASTFRAME.py \ 12 | boundaries.py boundariesMultiProcessor.py combineFiles.py createLabel.py \ 13 | gnuplot.py h5dump.py lava.py lava_points.py \ 14 | parseXML.py utmToLatLng.py 15 | 16 | imagesdir=$(pythondir) 17 | images_DATA=FreeSerif.ttf blankheight.png 18 | -------------------------------------------------------------------------------- /scripts/blankheight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/scripts/blankheight.png -------------------------------------------------------------------------------- /scripts/boundaries.py: -------------------------------------------------------------------------------- 1 | # this will write the boundaries of map 2 | 3 | import os 4 | import sys 5 | 6 | baseDir = sys.argv[1] 7 | 8 | #output directroy 9 | baseDir = baseDir+"/script_output" 10 | 11 | #open first points file 12 | pointsf = open(baseDir+"/"+"xdmf000000_i00000000.Points", 'r') 13 | 14 | save_x = "" 15 | save_first = "" 16 | save_last = "" 17 | 18 | greatest_x = 0 19 | greatest_z = 0 20 | 21 | for line in pointsf: 22 | #save first line 23 | if save_first == "": 24 | save_first = line 25 | #save last line 26 | save_last = line 27 | #find greatest x 28 | arr = line.split() 29 | if arr[0] > greatest_x: 30 | greatest_x = arr[0] 31 | save_x = line 32 | if float(arr[2]) > float(greatest_z): 33 | greatest_z = arr[2] 34 | 35 | pointsf.close() 36 | 37 | boundaries = open(baseDir+"/boundaries.txt", 'w') 38 | 39 | boundaries.write(save_first+"\n\n"+save_last+"\n\n"+save_x+"\n\n") 40 | 41 | boundaries.close() 42 | 43 | zrange = open(baseDir+"/zrange.txt", 'w') 44 | 45 | #round up to nearest 1000 46 | greatest_z = int( float(greatest_z) / 1000 ) 47 | greatest_z += 1 48 | greatest_z *= 1000 49 | 50 | zrange.write(str(greatest_z)) 51 | 52 | zrange.close() 53 | -------------------------------------------------------------------------------- /scripts/boundariesMultiProcessor.py: -------------------------------------------------------------------------------- 1 | # this will write the boundaries of map 2 | 3 | import os 4 | import sys 5 | 6 | baseDir = sys.argv[1] 7 | 8 | #output directroy 9 | baseDir = baseDir+"/script_output" 10 | 11 | #open first points file 12 | pointsf = open(baseDir+"/"+"xdmf000000_i00000000.Points", 'r') 13 | 14 | save_x = "" 15 | save_y = "" 16 | save_z = "" 17 | 18 | greatest_x = 0 19 | greatest_y = 0 20 | greatest_z = 0 21 | 22 | least_x = 0 23 | least_y = 0 24 | 25 | for line in pointsf: 26 | arr = line.split() 27 | if (least_x == 0): 28 | least_x = arr[0] 29 | least_y = arr[1] 30 | #find least x 31 | if arr[0] < least_x: 32 | least_x = arr[0] 33 | #find greatest x 34 | if arr[0] > greatest_x: 35 | greatest_x = arr[0] 36 | #find y 37 | #check if scientific notation 38 | if (str(arr[1]).find("e+", 0, len(arr[1])) != -1): 39 | split = arr[1].split("e+") 40 | numberY = float(split[0]) * (10**int(split[1])) 41 | #print split[0] + " * " + split[1] + " = " + str(numberY) 42 | else: 43 | numberY = float(arr[1]) 44 | #find least y 45 | if numberY < least_y: 46 | least_y = numberY 47 | #find greatest y 48 | if numberY > greatest_y: 49 | greatest_y = numberY 50 | #find greatest z 51 | if float(arr[2]) > float(greatest_z): 52 | greatest_z = arr[2] 53 | 54 | pointsf.close() 55 | 56 | boundaries = open(baseDir+"/boundaries.txt", 'w') 57 | 58 | least_y = "%e" % least_y 59 | greatest_y = "%e" % greatest_y 60 | 61 | boundaries.write(str(least_x)+"\t"+str(least_y)+"\t"+"0"+"\n\n") 62 | boundaries.write(str(greatest_x)+"\t"+str(least_y)+"\t"+"0"+"\n\n") 63 | boundaries.write(str(greatest_x)+"\t"+str(greatest_y)+"\t"+"0"+"\n\n") 64 | boundaries.write(str(least_x)+"\t"+str(greatest_y)+"\t"+"0"+"\n\n") 65 | 66 | boundaries.close() 67 | 68 | zrange = open(baseDir+"/zrange.txt", 'w') 69 | 70 | #round up to nearest 1000 71 | greatest_z = int( float(greatest_z) / 1000 ) 72 | greatest_z += 1 73 | greatest_z *= 1000 74 | 75 | zrange.write(str(greatest_z)) 76 | 77 | zrange.close() 78 | -------------------------------------------------------------------------------- /scripts/createLabel.py: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | from PIL import ImageDraw 3 | from PIL import ImageFont 4 | from os import chdir, path 5 | import sys 6 | 7 | def makeLabel(blankImage, fontDir, outImage, maxHeight,bg="#000000",fg="#ffffff",font="FreeSerif.ttf",FontSize=12): 8 | font_dir = fontDir 9 | img_name = outImage 10 | font_size = FontSize 11 | font_path = font_dir+font 12 | fnt = ImageFont.truetype(font_path, font_size) 13 | lineWidth = 20 14 | img = Image.open(blankImage) 15 | draw = ImageDraw.Draw(img) # setup to draw on the main image 16 | for x in range(11): 17 | text = "%.2f" % (maxHeight/10 *(10-x)) 18 | draw.text((10, 33 +22*x), text, font=fnt, fill="black") # add some text to the main 19 | del draw 20 | img.save(img_name,"JPEG",quality=100) 21 | -------------------------------------------------------------------------------- /scripts/driverKML.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Args: 4 | # $1 - Run Directory 5 | # $2 - TOOLDIR (not used) 6 | 7 | fullpath="$(readlink -f ${BASH_SOURCE})" 8 | TITAN2D_HOME="$(echo "$fullpath" | sed "s?/bin/driverKML.sh??")" 9 | TITAN2D_PYUTIL_DIR=$TITAN2D_HOME/lib/python2.7/site-packages 10 | TITAN2D_PYTHON=$TITAN2D_HOME/bin/titan 11 | 12 | if [ "@TITAN2D_PORTABLE@" = "yes" ] 13 | then 14 | #PATHS for portable version 15 | export PATH=$TITAN2D_HOME/lib/titan2d_dep/bin:$PATH 16 | elif [ "@TITAN2D_DEP@" != "no" ] 17 | then 18 | #PATHS for titan with titan_dep 19 | export PATH="@TITAN2D_DEP@/bin:$PATH" 20 | else 21 | #PATHS for titan with user specified dependencies 22 | export PATH=@HDF5_PATH@/bin:$PATH 23 | export LD_LIBRARY_PATH=@HDF5_PATH@/lib:$LD_LIBRARY_PATH 24 | fi 25 | 26 | cp $1/zone.txt $1/vizout/zone.txt 27 | cp $1/maxHeight_for_KML.data $1/vizout/maxHeight_for_KML.data 28 | 29 | echo "Running h5dump" 30 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/h5dump.py $1/vizout 31 | echo "Parsing XML" 32 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/parseXML.py $1/vizout 33 | echo "Combining Files" 34 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/combineFiles.py $1/vizout 35 | # On VHub, FreeSerif.ttf font file is in the 36 | # /usr/share/fonts/truetype/freefont directory. 37 | # Cannot assume this is true for all installations of the Titan2D GUI. 38 | # Look for FreeSerif.ttf font file in $TOOLDIR/bin directory. 39 | echo "Creating animated KML" 40 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/createVolcanoKML_POLYGONS_ANIMATION.py $1/vizout $TITAN2D_PYUTIL_DIR 41 | echo "Creating flat KML" 42 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/createVolcanoKML_POLYGONS_LASTFRAME.py $1/vizout $TITAN2D_PYUTIL_DIR 43 | -------------------------------------------------------------------------------- /scripts/driverMultiProcessor.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Args: 4 | # $1 - Run Directory 5 | # $2 - TOOLDIR (not used) 6 | 7 | fullpath="$(readlink -f ${BASH_SOURCE})" 8 | TITAN2D_HOME="$(echo "$fullpath" | sed "s?/bin/driverMultiProcessor.sh??")" 9 | TITAN2D_PYUTIL_DIR=$TITAN2D_HOME/lib/python2.7/site-packages 10 | TITAN2D_PYTHON=$TITAN2D_HOME/bin/titan 11 | 12 | if [ "@TITAN2D_PORTABLE@" = "yes" ] 13 | then 14 | #PATHS for portable version 15 | export PATH=$TITAN2D_HOME/lib/titan2d_dep/bin:$PATH 16 | elif [ "@TITAN2D_DEP@" != "no" ] 17 | then 18 | #PATHS for titan with titan_dep 19 | export PATH="@TITAN2D_DEP@/bin:$PATH" 20 | else 21 | #PATHS for titan with user specified dependencies 22 | export PATH=@HDF5_PATH@/bin:$PATH 23 | export LD_LIBRARY_PATH=@HDF5_PATH@/lib:$LD_LIBRARY_PATH 24 | fi 25 | 26 | RUN_DIR=$1/vizout 27 | 28 | cp $1/Stdout.txt $1/vizout/Stdout.txt 29 | 30 | echo "Running h5dump" 31 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/h5dump.py $RUN_DIR 32 | echo "Parsing XML" 33 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/parseXML.py $RUN_DIR 34 | echo "Combining Files" 35 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/combineFiles.py $RUN_DIR 36 | echo "Running boundariesMultiProcessor" 37 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/boundariesMultiProcessor.py $RUN_DIR 38 | echo "Running lava" 39 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/lava.py $RUN_DIR 40 | echo "Running lava_points" 41 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/lava_points.py $RUN_DIR 42 | 43 | echo "Running gnuplot.py" 44 | if [ $# == 2 ] ; then 45 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/gnuplot.py $RUN_DIR 46 | else 47 | $TITAN2D_PYTHON $TITAN2D_PYUTIL_DIR/gnuplot.py $RUN_DIR $3 48 | fi 49 | -------------------------------------------------------------------------------- /scripts/h5dump.py: -------------------------------------------------------------------------------- 1 | #This will dump Points and PILE_HEIGHT from h5 file to text file 2 | 3 | import os 4 | import sys 5 | 6 | baseDir = sys.argv[1] 7 | directory = baseDir + "/script_output" 8 | 9 | #output directroy that everything will go in to make the animation and images 10 | if not os.path.exists(directory): 11 | os.makedirs(directory) 12 | else: 13 | os.system("rm "+directory+"/*.*") 14 | 15 | dirList = os.listdir(baseDir) 16 | for fname in dirList: 17 | fileSplit = fname.split('.') 18 | #print ("fileSplit: ", fileSplit) 19 | #check to see if its a file 20 | if len(fileSplit) > 1: 21 | #check to see if its a h5 file 22 | if fileSplit[1] == "h5": 23 | #create xml file in new output directory script_ouput/ 24 | os.system("h5dump -x "+baseDir+"/"+fname+" > "+baseDir+"/script_output/"+fileSplit[0]+".xml") 25 | -------------------------------------------------------------------------------- /scripts/lava.py: -------------------------------------------------------------------------------- 1 | # this program will extract the lava flow info from Points.txt 2 | # this will show just the lava flow 3 | 4 | # this will need 3 points added to fit with base map 5 | 6 | 7 | import os 8 | import sys 9 | 10 | baseDir = sys.argv[1] 11 | 12 | #output directroy 13 | baseDir = baseDir+"/script_output" 14 | 15 | 16 | 17 | dirList = os.listdir(baseDir) 18 | for fname in dirList: 19 | fileSplit = fname.split('.') 20 | #check to see if its a file 21 | if len(fileSplit) > 1: 22 | #check to see if its a PILE_HEIGHT 23 | if fileSplit[1] == "PILE_HEIGHT": 24 | 25 | 26 | #open points 27 | pointsf = open(baseDir+"/"+fileSplit[0]+'.Points', 'r') 28 | #open pile_height 29 | pilef = open(baseDir+"/"+fileSplit[0]+'.PILE_HEIGHT', 'r') 30 | #open lava file to write 31 | lavaf = open(baseDir+"/"+fileSplit[0]+'.lava', 'w') 32 | 33 | #open boundaries file 34 | boundaries = open(baseDir+"/boundaries.txt", 'r') 35 | 36 | #read all line boundaries into lava file 37 | lavaf.write(boundaries.read()) 38 | 39 | boundaries.close() 40 | 41 | pilel = pilef.readline() 42 | 43 | while pilel: 44 | if (pilel == '0\n'): 45 | pointsf.readline() 46 | pointsf.readline() 47 | pointsf.readline() 48 | pointsf.readline() 49 | else: 50 | line1 = pointsf.readline().split() 51 | x1 = float(line1[0]) 52 | y1 = float(line1[1]) 53 | z1 = float(line1[2]) 54 | line2 = pointsf.readline().split() 55 | x2 = float(line2[0]) 56 | y2 = float(line2[1]) 57 | z2 = float(line2[2]) 58 | line3 = pointsf.readline().split() 59 | x3 = float(line3[0]) 60 | y3 = float(line3[1]) 61 | z3 = float(line3[2]) 62 | line4 = pointsf.readline().split() 63 | x4 = float(line4[0]) 64 | y4 = float(line4[1]) 65 | z4 = float(line4[2]) 66 | #get center points 67 | center_x = ((x2-x1)/2)+x1 68 | center_y = ((y3-y2)/2)+y2 69 | #get average height 70 | center_z = ((z1+z2+z3+z4)/4)+float(pilel) 71 | #print 72 | lavaf.write(str(center_x)+"\t"+str(center_y)+"\t"+str(center_z)+"\n\n") 73 | 74 | pilel = pilef.readline() 75 | 76 | pointsf.close() 77 | pilef.close() 78 | lavaf.close() -------------------------------------------------------------------------------- /scripts/titan_pilehelper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #******************************************************************* 3 | #* Copyright (C) 2003 University at Buffalo 4 | #* 5 | #* This software can be redistributed free of charge. See COPYING 6 | #* file in the top distribution directory for more details. 7 | #* 8 | #* This software is distributed in the hope that it will be useful, 9 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | #* 12 | #* Author: Alex Sorokine 13 | #* Description: Helper script to bring up GRASS display, show map, and get coordinates 14 | #* 15 | #******************************************************************* 16 | #* $Id: titan_pilehelper 2 2003-08-13 19:26:11Z sorokine $ 17 | #* 18 | 19 | 20 | # check if display is running 21 | savemon=`d.mon -p | sed -e '/^No/d' -e 's/[^:]*: \(x[0-9]\)$/\1/'` 22 | tmpmon=x4 23 | d.mon start=$tmpmon 24 | d.rast $1 25 | d.where -1 > $2 26 | d.mon stop=$tmpmon 27 | if [ "$savemon" ]; then 28 | d.mon select=$savemon 29 | fi 30 | 31 | -------------------------------------------------------------------------------- /scripts/titan_regionhelper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #******************************************************************* 3 | #* Copyright (C) 2003 University at Buffalo 4 | #* 5 | #* This software can be redistributed free of charge. See COPYING 6 | #* file in the top distribution directory for more details. 7 | #* 8 | #* This software is distributed in the hope that it will be useful, 9 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | #* 12 | #* Author: Alex Sorokine 13 | #* Description: Helper script to bring up GRASS display, show map, and get coordinates 14 | #* 15 | #******************************************************************* 16 | #* $Id: titan_regionhelper 2 2003-08-13 19:26:11Z sorokine $ 17 | #* 18 | 19 | # usage: 20 | # _regionhelper raster_name 1 region_file 21 | # 1 is to bring up a new monitor, anything else -- use current monitor 22 | # region_file file to save region 23 | 24 | rast=$1 25 | newmon=$2 26 | 27 | # check if display is running 28 | if [ "$newmon" == "1" ]; then 29 | savemon=`d.mon -p | sed -e '/^No/d' -e 's/[^:]*: \(x[0-9]\)$/\1/'` 30 | tmpmon=x4 31 | d.mon start=$tmpmon 32 | d.rast $1 33 | fi 34 | 35 | # save current region 36 | saveregion=gmfg`date +%s` 37 | g.region save=$saveregion 38 | 39 | # select a new region 40 | d.zoom 41 | 42 | # report new region 43 | g.region -g | sed -e '/res/d' -e 's/^\(n\|s\|w\|e\)=//' | sed -e ':a;$!N;s/\n/ /;ta;' > $3 44 | 45 | # restore initial region 46 | g.region region=$saveregion 47 | g.remove region=$saveregion 48 | 49 | # get rid of an old monitor 50 | if [ "$newmon" == "1" ]; then 51 | d.mon stop=$tmpmon 52 | fi 53 | if [ "$savemon" ]; then 54 | d.mon select=$savemon 55 | fi 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /scripts/utmToLatLng.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | def utmToLatLng(zone, easting, northing, northernHemisphere=True): 4 | 5 | # http://stackoverflow.com/questions/343865/how-to-convert-from-utm-to-latlng-in-python-or-javascript 6 | 7 | if not northernHemisphere: 8 | northing = 10000000 - northing 9 | 10 | a = 6378137 11 | e = 0.081819191 12 | e1sq = 0.006739497 13 | k0 = 0.9996 14 | 15 | arc = northing / k0 16 | mu = arc / (a * (1 - math.pow(e, 2) / 4.0 - 3 * math.pow(e, 4) / 64.0 - 5 * math.pow(e, 6) / 256.0)) 17 | 18 | ei = (1 - math.pow((1 - e * e), (1 / 2.0))) / (1 + math.pow((1 - e * e), (1 / 2.0))) 19 | 20 | ca = 3 * ei / 2 - 27 * math.pow(ei, 3) / 32.0 21 | 22 | cb = 21 * math.pow(ei, 2) / 16 - 55 * math.pow(ei, 4) / 32 23 | cc = 151 * math.pow(ei, 3) / 96 24 | cd = 1097 * math.pow(ei, 4) / 512 25 | phi1 = mu + ca * math.sin(2 * mu) + cb * math.sin(4 * mu) + cc * math.sin(6 * mu) + cd * math.sin(8 * mu) 26 | 27 | n0 = a / math.pow((1 - math.pow((e * math.sin(phi1)), 2)), (1 / 2.0)) 28 | 29 | r0 = a * (1 - e * e) / math.pow((1 - math.pow((e * math.sin(phi1)), 2)), (3 / 2.0)) 30 | fact1 = n0 * math.tan(phi1) / r0 31 | 32 | _a1 = 500000 - easting 33 | dd0 = _a1 / (n0 * k0) 34 | fact2 = dd0 * dd0 / 2 35 | 36 | t0 = math.pow(math.tan(phi1), 2) 37 | Q0 = e1sq * math.pow(math.cos(phi1), 2) 38 | fact3 = (5 + 3 * t0 + 10 * Q0 - 4 * Q0 * Q0 - 9 * e1sq) * math.pow(dd0, 4) / 24 39 | 40 | fact4 = (61 + 90 * t0 + 298 * Q0 + 45 * t0 * t0 - 252 * e1sq - 3 * Q0 * Q0) * math.pow(dd0, 6) / 720 41 | 42 | lof1 = _a1 / (n0 * k0) 43 | lof2 = (1 + 2 * t0 + Q0) * math.pow(dd0, 3) / 6.0 44 | lof3 = (5 - 2 * Q0 + 28 * t0 - 3 * math.pow(Q0, 2) + 8 * e1sq + 24 * math.pow(t0, 2)) * math.pow(dd0, 5) / 120 45 | _a2 = (lof1 - lof2 + lof3) / math.cos(phi1) 46 | _a3 = _a2 * 180 / math.pi 47 | 48 | latitude = 180 * (phi1 - fact1 * (fact2 + fact3 + fact4)) / math.pi 49 | 50 | if not northernHemisphere: 51 | latitude = -latitude 52 | 53 | longitude = ((zone > 0) and (6 * zone - 183.0) or 3.0) - _a3 54 | 55 | return (latitude, longitude) -------------------------------------------------------------------------------- /share/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # copy examples 3 | # 4 | 5 | install-data-local: 6 | echo Copying examples 7 | cp -rf $(srcdir)/titan2d_examples $(datarootdir) 8 | chmod 755 $(datarootdir)/titan2d_examples/run_all_examples.sh -------------------------------------------------------------------------------- /share/titan2d_examples/colimafinemini/Coulomb/input.py: -------------------------------------------------------------------------------- 1 | sim=TitanSimulation(overwrite_output=True) 2 | 3 | sim.setGIS( 4 | gis_format='GIS_GRASS', 5 | gis_main='../../dem', 6 | gis_sub='colimafinemini', 7 | gis_mapset='PERMANENT', 8 | gis_map='colima' 9 | ) 10 | 11 | sim.setScale( 12 | length_scale=4000.0, 13 | gravity_scale=9.8, 14 | ) 15 | 16 | sim.setNumProp( 17 | AMR=True, 18 | number_of_cells_across_axis=16, 19 | order='First', 20 | ) 21 | sim.setMatModel( 22 | model='Coulomb', 23 | int_frict=37.0, 24 | bed_frict=27.0 25 | ) 26 | sim.addPile( 27 | pile_type='Cylinder', 28 | height=30.0, 29 | center=[644956.0, 2157970.0], 30 | radii=[55.0, 55.0], 31 | orientation=0.0, 32 | Vmagnitude=0.0, 33 | Vdirection=0.0, 34 | ) 35 | 36 | sim.setTimeProps( 37 | max_iter=5000, 38 | ) 39 | 40 | sim.setTimeSeriesOutput( 41 | vizoutput=('xdmf','meshplot'), 42 | dtime=1.0, 43 | ) 44 | 45 | #start simulation 46 | sim.run() 47 | -------------------------------------------------------------------------------- /share/titan2d_examples/colimafinemini/Coulomb_FluxSrc_DischPlane/input.py: -------------------------------------------------------------------------------- 1 | sim=TitanSimulation(overwrite_output=True) 2 | 3 | sim.setGIS( 4 | gis_format='GIS_GRASS', 5 | gis_main='../../dem', 6 | gis_sub='colimafinemini', 7 | gis_mapset='PERMANENT', 8 | gis_map='colima' 9 | ) 10 | 11 | sim.setScale( 12 | length_scale=4000.0, 13 | gravity_scale=9.8, 14 | ) 15 | 16 | sim.setNumProp( 17 | AMR=True, 18 | number_of_cells_across_axis=16, 19 | order='First', 20 | ) 21 | sim.setMatModel( 22 | model='Coulomb', 23 | int_frict=37.0, 24 | bed_frict=27.0 25 | ) 26 | sim.addPile( 27 | pile_type='Cylinder', 28 | height=30.0, 29 | center=[644956.0, 2157970.0], 30 | radii=[55.0, 55.0], 31 | orientation=0.0, 32 | Vmagnitude=0.0, 33 | Vdirection=0.0, 34 | ) 35 | sim.addFluxSource( 36 | influx=10.0, 37 | start_time=5.0, 38 | end_time=20.0, 39 | center=[644956.0, 2157970.0], 40 | radii=[55.0, 55.0], 41 | orientation=0.0, 42 | Vmagnitude=0.0, 43 | Vdirection=0.0 44 | ) 45 | sim.addDischargePlane(637380.0, 2145800.0, 664380.0, 2169800.0) 46 | 47 | sim.setTimeProps( 48 | max_iter=5000, 49 | ) 50 | 51 | sim.setTimeSeriesOutput( 52 | vizoutput=('xdmf','meshplot'), 53 | dtime=1.0, 54 | ) 55 | 56 | #start simulation 57 | sim.run() 58 | -------------------------------------------------------------------------------- /share/titan2d_examples/colimafinemini/Coulomb_GeoTIFF/input.py: -------------------------------------------------------------------------------- 1 | sim=TitanSimulation(overwrite_output=True) 2 | 3 | sim.setGIS( 4 | gis_format='GDAL', 5 | gis_map='../../dem/colimafinemini.geotiff' 6 | ) 7 | 8 | sim.setScale( 9 | length_scale=4000.0, 10 | gravity_scale=9.8, 11 | ) 12 | 13 | sim.setNumProp( 14 | AMR=True, 15 | number_of_cells_across_axis=16, 16 | order='First', 17 | ) 18 | sim.setMatModel( 19 | model='Coulomb', 20 | int_frict=37.0, 21 | bed_frict=27.0 22 | ) 23 | sim.addPile( 24 | pile_type='Cylinder', 25 | height=30.0, 26 | center=[644956.0, 2157970.0], 27 | radii=[55.0, 55.0], 28 | orientation=0.0, 29 | Vmagnitude=0.0, 30 | Vdirection=0.0, 31 | ) 32 | 33 | sim.setTimeProps( 34 | max_iter=5000, 35 | ) 36 | 37 | sim.setTimeSeriesOutput( 38 | vizoutput='xdmf', 39 | dtime=1.0, 40 | ) 41 | 42 | #start simulation 43 | sim.run() 44 | -------------------------------------------------------------------------------- /share/titan2d_examples/colimafinemini/Coulomb_with_stopping/input.py: -------------------------------------------------------------------------------- 1 | sim=TitanSimulation(overwrite_output=True) 2 | 3 | sim.setGIS( 4 | gis_format='GIS_GRASS', 5 | gis_main='../../dem', 6 | gis_sub='colimafinemini', 7 | gis_mapset='PERMANENT', 8 | gis_map='colima' 9 | ) 10 | 11 | sim.setScale( 12 | length_scale=4000.0, 13 | gravity_scale=9.8, 14 | ) 15 | 16 | sim.setNumProp( 17 | AMR=True, 18 | number_of_cells_across_axis=16, 19 | order='First', 20 | ) 21 | sim.setMatModel( 22 | model='Coulomb', 23 | stopping_criteria='DragBased', 24 | int_frict=37.0, 25 | bed_frict=27.0 26 | ) 27 | sim.addPile( 28 | pile_type='Cylinder', 29 | height=30.0, 30 | center=[644956.0, 2157970.0], 31 | radii=[55.0, 55.0], 32 | orientation=0.0, 33 | Vmagnitude=0.0, 34 | Vdirection=0.0, 35 | ) 36 | 37 | sim.setTimeProps( 38 | max_iter=5000, 39 | ) 40 | 41 | sim.setTimeSeriesOutput( 42 | vizoutput='xdmf', 43 | dtime=1.0, 44 | ) 45 | 46 | #start simulation 47 | sim.run() 48 | -------------------------------------------------------------------------------- /share/titan2d_examples/colimafinemini/Pouliquen_Forterre/input.py: -------------------------------------------------------------------------------- 1 | sim=TitanSimulation(overwrite_output=True) 2 | 3 | sim.setGIS( 4 | gis_format='GIS_GRASS', 5 | gis_main='../../dem', 6 | gis_sub='colimafinemini', 7 | gis_mapset='PERMANENT', 8 | gis_map='colima' 9 | ) 10 | 11 | sim.setScale( 12 | length_scale=4000.0, 13 | gravity_scale=9.8, 14 | ) 15 | 16 | sim.setNumProp( 17 | AMR=True, 18 | number_of_cells_across_axis=16, 19 | order='First', 20 | ) 21 | sim.setMatModel( 22 | model='Pouliquen-Forterre', 23 | phi1=32.9, 24 | phi2=42.0, 25 | phi3=33.9, 26 | Beta=0.65, 27 | L_material=1.0E-3, 28 | ) 29 | sim.addPile( 30 | pile_type='Cylinder', 31 | height=30.0, 32 | center=[644956.0, 2157970.0], 33 | radii=[55.0, 55.0], 34 | orientation=0.0, 35 | Vmagnitude=0.0, 36 | Vdirection=0.0, 37 | ) 38 | 39 | sim.setTimeProps( 40 | max_iter=5000, 41 | ) 42 | 43 | sim.setTimeSeriesOutput( 44 | vizoutput=('xdmf','meshplot'), 45 | dtime=1.0, 46 | ) 47 | 48 | #start simulation 49 | sim.run() 50 | -------------------------------------------------------------------------------- /share/titan2d_examples/colimafinemini/TwoPhases_Pitman_Le/input.py: -------------------------------------------------------------------------------- 1 | # 2 | # About this simulation: 3 | # 4 | # NOTE what this simulation uses a different DEM 5 | # This simulation require bigger region and to keep 6 | # example sizes small, the fine map was coarsened 7 | # 8 | # it also require much more iterations and execution time 9 | # because pile project itself further 10 | 11 | sim=TitanSimulation(overwrite_output=True) 12 | 13 | sim.setGIS( 14 | gis_format='GIS_GRASS', 15 | gis_main='../../dem', 16 | gis_sub='colimacoarse', 17 | gis_mapset='PERMANENT', 18 | gis_map='colima' 19 | ) 20 | 21 | sim.setScale( 22 | length_scale=4000.0, 23 | gravity_scale=9.8, 24 | ) 25 | 26 | sim.setNumProp( 27 | AMR=True, 28 | number_of_cells_across_axis=16, 29 | order='First', 30 | ) 31 | sim.setMatModel( 32 | model='TwoPhases-Pitman-Le', 33 | int_frict=37.0, 34 | bed_frict=27.0 35 | ) 36 | sim.addPile( 37 | pile_type='Paraboloid', 38 | height=30.0, 39 | center=[644956.0, 2157970.0], 40 | radii=[55.0, 55.0], 41 | orientation=0.0, 42 | Vmagnitude=0.0, 43 | Vdirection=0.0, 44 | vol_fract=0.7, 45 | ) 46 | 47 | sim.setTimeProps( 48 | max_iter=18000, 49 | ) 50 | 51 | sim.setTimeSeriesOutput( 52 | vizoutput='xdmf', 53 | dtime=1.0, 54 | ) 55 | 56 | #if not set default settings are used 57 | sim.setOutlineProps( 58 | output_prefix='', 59 | enabled=True, 60 | max_linear_size=1024, 61 | init_size='AMR' 62 | ) 63 | #dump restart file every dtime simulated seconds and/or diter interations 64 | sim.setRestartOutput( 65 | enabled=True, 66 | dtime=1.0,#float or None, default=None 67 | diter=None,#int or None, default=None 68 | keep_all=True, #True - keep all restart files or False - only last default=False? 69 | keep_redundant_data=True, 70 | output_prefix='restart', #directory name where restart h5 and individual xdmf are stored, prefix for time series xdmf, default='restart' 71 | ) 72 | 73 | #start simulation 74 | sim.run() 75 | -------------------------------------------------------------------------------- /share/titan2d_examples/colimafinemini/Voellmy_Salm/input.py: -------------------------------------------------------------------------------- 1 | sim=TitanSimulation(overwrite_output=True) 2 | 3 | sim.setGIS( 4 | gis_format='GIS_GRASS', 5 | gis_main='../../dem', 6 | gis_sub='colimafinemini', 7 | gis_mapset='PERMANENT', 8 | gis_map='colima', 9 | ) 10 | 11 | sim.setScale( 12 | length_scale=4000.0, 13 | gravity_scale=9.8, 14 | ) 15 | 16 | sim.setNumProp( 17 | AMR=True, 18 | number_of_cells_across_axis=16, 19 | order='First', 20 | ) 21 | sim.setMatModel( 22 | model='Voellmy-Salm', 23 | 24 | mu = 0.5, 25 | xi = 120.0, 26 | ) 27 | sim.addPile( 28 | pile_type='Cylinder', 29 | height=30.0, 30 | center=[644956.0, 2157970.0], 31 | radii=[55.0, 55.0], 32 | orientation=0.0, 33 | Vmagnitude=0.0, 34 | Vdirection=0.0, 35 | ) 36 | 37 | sim.setTimeProps( 38 | max_iter=5000, 39 | ) 40 | 41 | sim.setTimeSeriesOutput( 42 | vizoutput=('xdmf','meshplot'), 43 | dtime=1.0, 44 | ) 45 | 46 | #start simulation 47 | sim.run() 48 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/.bash_history: -------------------------------------------------------------------------------- 1 | r.proj location=colimafine mapset=PERMANENT input=colima 2 | r.fillnulls --overwrite input=colima@PERMANENT output=colima method=rst 3 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/.bashrc: -------------------------------------------------------------------------------- 1 | test -r ~/.alias && . ~/.alias 2 | PS1='GRASS 7.0.4 (colimacoarse):\w > ' 3 | grass_prompt() { 4 | LOCATION="`g.gisenv get=GISDBASE,LOCATION_NAME,MAPSET separator='/'`" 5 | if test -d "$LOCATION/grid3/G3D_MASK" && test -f "$LOCATION/cell/MASK" ; then 6 | echo [2D and 3D raster MASKs present] 7 | elif test -f "$LOCATION/cell/MASK" ; then 8 | echo [Raster MASK present] 9 | elif test -d "$LOCATION/grid3/G3D_MASK" ; then 10 | echo [3D raster MASK present] 11 | fi 12 | } 13 | PROMPT_COMMAND=grass_prompt 14 | export GRASS_GNUPLOT="gnuplot -persist" 15 | export GRASS_PROJSHARE=/usr/share/proj 16 | export GRASS_ADDON_BASE=/home/mikola/.grass7/addons 17 | export GRASS_HTML_BROWSER=xdg-open 18 | export GRASS_PYTHON=python 19 | export GRASS_PAGER=pager 20 | export GRASS_VERSION=7.0.4 21 | export PATH="/usr/lib/grass70/bin:/usr/lib/grass70/scripts:/home/mikola/.grass7/addons/bin:/home/mikola/.grass7/addons/scripts:/var/www/akrr/bin:/usr/local/ParaView-4.4.0-Qt4-Linux-64bit/bin:/usr/local/openmpi-1.10.1-icc/bin:/opt/intel/compilers_and_libraries_2016.1.150/linux/bin/intel64:/opt/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/bin:/opt/intel/debugger_2016/gdb/intel64_mic/bin:/var/www/akrr/bin:/usr/local/ParaView-4.4.0-Qt4-Linux-64bit/bin:/usr/local/openmpi-1.10.1-icc/bin:/opt/intel/compilers_and_libraries_2016.1.150/linux/bin/intel64:/opt/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/bin:/opt/intel/debugger_2016/gdb/intel64_mic/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" 22 | export HOME="/home/mikola" 23 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/.gislock: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/.tmp/blackbox/6758.0.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/colimacoarse/PERMANENT/.tmp/blackbox/6758.0.ppm -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/DEFAULT_WIND: -------------------------------------------------------------------------------- 1 | proj: 1 2 | zone: 13 3 | north: 2161000 4 | south: 2142280 5 | east: 648000 6 | west: 629320 7 | cols: 934 8 | rows: 936 9 | e-w resol: 20 10 | n-s resol: 20 11 | top: 1.000000000000000 12 | bottom: 0.000000000000000 13 | cols3: 18680 14 | rows3: 18720 15 | depths: 1 16 | e-w resol3: 1 17 | n-s resol3: 1 18 | t-b resol: 1 19 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/MYNAME: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/PROJ_INFO: -------------------------------------------------------------------------------- 1 | name: UTM Zone 13, Northern Hemisphere 2 | proj: utm 3 | zone: 13 4 | no_defs: defined 5 | datum: wgs84 6 | ellps: wgs84 7 | towgs84: 0.000,0.000,0.000 8 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/PROJ_UNITS: -------------------------------------------------------------------------------- 1 | unit: Meter 2 | units: Meters 3 | meters: 1 4 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/VAR: -------------------------------------------------------------------------------- 1 | DB_DRIVER: sqlite 2 | DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db 3 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/WIND: -------------------------------------------------------------------------------- 1 | proj: 1 2 | zone: 13 3 | north: 2161000 4 | south: 2142280 5 | east: 648000 6 | west: 629320 7 | cols: 934 8 | rows: 936 9 | e-w resol: 20 10 | n-s resol: 20 11 | top: 1.000000000000000 12 | bottom: 0.000000000000000 13 | cols3: 18680 14 | rows3: 18720 15 | depths: 1 16 | e-w resol3: 1 17 | n-s resol3: 1 18 | t-b resol: 1 19 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/cats/colima: -------------------------------------------------------------------------------- 1 | # 0 categories 2 | 3 | 4 | 0.00 0.00 0.00 0.00 5 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/cell/colima: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/colimacoarse/PERMANENT/cell/colima -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/cell_misc/colima/f_format: -------------------------------------------------------------------------------- 1 | type: float 2 | byte_order: xdr 3 | lzw_compression_bits: -1 4 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/cell_misc/colima/f_quant: -------------------------------------------------------------------------------- 1 | round -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/cell_misc/colima/f_range: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/colimacoarse/PERMANENT/cell_misc/colima/f_range -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/cellhd/colima: -------------------------------------------------------------------------------- 1 | proj: 1 2 | zone: 13 3 | north: 2161000 4 | south: 2142280 5 | east: 648000 6 | west: 629320 7 | cols: 934 8 | rows: 936 9 | e-w resol: 20 10 | n-s resol: 20 11 | format: -1 12 | compressed: 2 13 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/fcell/colima: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/colimacoarse/PERMANENT/fcell/colima -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/hist/colima: -------------------------------------------------------------------------------- 1 | Thu May 19 23:15:49 2016 2 | colima 3 | PERMANENT 4 | mikola 5 | raster 6 | 7 | 8 | generated by r.patch 9 | r.patch --overwrite input="colima@PERMANENT,r_fillnulls_7055_filled"\ 10 | output="colima" 11 | r.fillnulls "--overwrite" "input=colima@PERMANENT" "output=colima" "met 12 | hod=rst" 13 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimacoarse/PERMANENT/sqlite/sqlite.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/colimacoarse/PERMANENT/sqlite/sqlite.db -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini.geotiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/colimafinemini.geotiff -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/.bash_history: -------------------------------------------------------------------------------- 1 | r.proj location=colimafine mapset=PERMANENT input=colima 2 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/.bashrc: -------------------------------------------------------------------------------- 1 | test -r ~/.alias && . ~/.alias 2 | PS1='GRASS 7.0.4 (colimafinemini):\w > ' 3 | grass_prompt() { 4 | LOCATION="`g.gisenv get=GISDBASE,LOCATION_NAME,MAPSET separator='/'`" 5 | if test -d "$LOCATION/grid3/G3D_MASK" && test -f "$LOCATION/cell/MASK" ; then 6 | echo [2D and 3D raster MASKs present] 7 | elif test -f "$LOCATION/cell/MASK" ; then 8 | echo [Raster MASK present] 9 | elif test -d "$LOCATION/grid3/G3D_MASK" ; then 10 | echo [3D raster MASK present] 11 | fi 12 | } 13 | PROMPT_COMMAND=grass_prompt 14 | export GRASS_GNUPLOT="gnuplot -persist" 15 | export GRASS_PROJSHARE=/usr/share/proj 16 | export GRASS_ADDON_BASE=/home/mikola/.grass7/addons 17 | export GRASS_HTML_BROWSER=xdg-open 18 | export GRASS_PYTHON=python 19 | export GRASS_PAGER=pager 20 | export GRASS_VERSION=7.0.4 21 | export PATH="/usr/lib/grass70/bin:/usr/lib/grass70/scripts:/home/mikola/.grass7/addons/bin:/home/mikola/.grass7/addons/scripts:/var/www/akrr/bin:/usr/local/ParaView-4.4.0-Qt4-Linux-64bit/bin:/usr/local/openmpi-1.10.1-icc/bin:/opt/intel/compilers_and_libraries_2016.1.150/linux/bin/intel64:/opt/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/bin:/opt/intel/debugger_2016/gdb/intel64_mic/bin:/var/www/akrr/bin:/usr/local/ParaView-4.4.0-Qt4-Linux-64bit/bin:/usr/local/openmpi-1.10.1-icc/bin:/opt/intel/compilers_and_libraries_2016.1.150/linux/bin/intel64:/opt/intel/compilers_and_libraries_2016.1.150/linux/mpi/intel64/bin:/opt/intel/debugger_2016/gdb/intel64_mic/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" 22 | export HOME="/home/mikola" 23 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/.gislock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/colimafinemini/PERMANENT/.gislock -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/.tmp/blackbox/6586.0.ppm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/colimafinemini/PERMANENT/.tmp/blackbox/6586.0.ppm -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/DEFAULT_WIND: -------------------------------------------------------------------------------- 1 | proj: 1 2 | zone: 13 3 | north: 2159000 4 | south: 2154500 5 | east: 646000 6 | west: 641500 7 | cols: 900 8 | rows: 900 9 | e-w resol: 5 10 | n-s resol: 5 11 | top: 1.000000000000000 12 | bottom: 0.000000000000000 13 | cols3: 4500 14 | rows3: 4500 15 | depths: 1 16 | e-w resol3: 1 17 | n-s resol3: 1 18 | t-b resol: 1 19 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/MYNAME: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/PROJ_INFO: -------------------------------------------------------------------------------- 1 | name: UTM Zone 13, Northern Hemisphere 2 | proj: utm 3 | zone: 13 4 | no_defs: defined 5 | datum: wgs84 6 | ellps: wgs84 7 | towgs84: 0.000,0.000,0.000 8 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/PROJ_UNITS: -------------------------------------------------------------------------------- 1 | unit: Meter 2 | units: Meters 3 | meters: 1 4 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/VAR: -------------------------------------------------------------------------------- 1 | DB_DRIVER: sqlite 2 | DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db 3 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/WIND: -------------------------------------------------------------------------------- 1 | proj: 1 2 | zone: 13 3 | north: 2159000 4 | south: 2154500 5 | east: 646000 6 | west: 641500 7 | cols: 900 8 | rows: 900 9 | e-w resol: 5 10 | n-s resol: 5 11 | top: 1.000000000000000 12 | bottom: 0.000000000000000 13 | cols3: 4500 14 | rows3: 4500 15 | depths: 1 16 | e-w resol3: 1 17 | n-s resol3: 1 18 | t-b resol: 1 19 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/cats/colima: -------------------------------------------------------------------------------- 1 | # 0 categories 2 | 3 | 4 | 0.00 0.00 0.00 0.00 5 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/cell/colima: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/colimafinemini/PERMANENT/cell/colima -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/cell_misc/colima/f_format: -------------------------------------------------------------------------------- 1 | type: float 2 | byte_order: xdr 3 | lzw_compression_bits: -1 4 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/cell_misc/colima/f_quant: -------------------------------------------------------------------------------- 1 | round -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/cell_misc/colima/f_range: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/colimafinemini/PERMANENT/cell_misc/colima/f_range -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/cellhd/colima: -------------------------------------------------------------------------------- 1 | proj: 1 2 | zone: 13 3 | north: 2159000 4 | south: 2154500 5 | east: 646000 6 | west: 641500 7 | cols: 900 8 | rows: 900 9 | e-w resol: 5 10 | n-s resol: 5 11 | format: -1 12 | compressed: 2 13 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/fcell/colima: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/colimafinemini/PERMANENT/fcell/colima -------------------------------------------------------------------------------- /share/titan2d_examples/dem/colimafinemini/PERMANENT/hist/colima: -------------------------------------------------------------------------------- 1 | Thu May 19 13:37:38 2016 2 | colima 3 | PERMANENT 4 | mikola 5 | raster 6 | 7 | 8 | generated by r.proj 9 | r.proj location="colimafine" mapset="PERMANENT" input="colima" metho\ 10 | d="nearest" memory=300 11 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/DEFAULT_WIND: -------------------------------------------------------------------------------- 1 | proj: 0 2 | zone: 0 3 | north: 0.622 4 | south: -0.012 5 | east: 1.581 6 | west: -0.031 7 | cols: 1612 8 | rows: 634 9 | e-w resol: 0.001 10 | n-s resol: 0.001 11 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/VAR: -------------------------------------------------------------------------------- 1 | DB_DRIVER: sqlite 2 | DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db 3 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/WIND: -------------------------------------------------------------------------------- 1 | proj: 0 2 | zone: 0 3 | north: 0.622 4 | south: -0.012 5 | east: 1.581 6 | west: -0.031 7 | cols: 1612 8 | rows: 634 9 | e-w resol: 0.001 10 | n-s resol: 0.001 11 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/cats/inclined: -------------------------------------------------------------------------------- 1 | # 255 categories 2 | 3 | 4 | 0.00 0.00 0.00 0.00 5 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/cats/inclined_Mat: -------------------------------------------------------------------------------- 1 | # 3 categories 2 | 3 | 4 | 0.00 0.00 0.00 0.00 5 | 1:Mat 1 6 | 2:Mat 2 7 | 3:Mat 3 8 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/cell/inclined: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/inclined/PERMANENT/cell/inclined -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/cell/inclined_Mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/inclined/PERMANENT/cell/inclined_Mat -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/cell_misc/inclined/f_format: -------------------------------------------------------------------------------- 1 | type: float 2 | byte_order: xdr 3 | lzw_compression_bits: -1 4 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/cell_misc/inclined/f_quant: -------------------------------------------------------------------------------- 1 | round -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/cell_misc/inclined/f_range: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/inclined/PERMANENT/cell_misc/inclined/f_range -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/cell_misc/inclined_Mat/range: -------------------------------------------------------------------------------- 1 | 1 3 2 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/cellhd/inclined: -------------------------------------------------------------------------------- 1 | proj: 0 2 | zone: 0 3 | north: 0.622 4 | south: -0.012 5 | east: 1.581 6 | west: -0.031 7 | cols: 1612 8 | rows: 634 9 | e-w resol: 0.001 10 | n-s resol: 0.001 11 | format: -1 12 | compressed: 1 13 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/cellhd/inclined_Mat: -------------------------------------------------------------------------------- 1 | proj: 0 2 | zone: 0 3 | north: 0.622 4 | south: -0.012 5 | east: 1.581 6 | west: -0.031 7 | cols: 1612 8 | rows: 634 9 | e-w resol: 0.001 10 | n-s resol: 0.001 11 | format: 0 12 | compressed: 1 13 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/colr/inclined_Mat: -------------------------------------------------------------------------------- 1 | % 1 3 2 | 1:255:255:0 1.3999999999999999:0:255:0 3 | 1.3999999999999999:0:255:0 1.8:0:255:255 4 | 1.8:0:255:255 2.2000000000000002:0:0:255 5 | 2.2000000000000002:0:0:255 2.6000000000000001:255:0:255 6 | 2.6000000000000001:255:0:255 3:255:0:0 7 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/fcell/inclined: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/inclined/PERMANENT/fcell/inclined -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/hist/inclined: -------------------------------------------------------------------------------- 1 | Tue Mar 2 13:30:22 2004 2 | inclined 3 | inclined 4 | acwebber 5 | raster 6 | 7 | 8 | generated by r.in.arc 9 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/hist/inclined_Mat: -------------------------------------------------------------------------------- 1 | Thu Apr 28 16:33:51 2016 2 | inclined_Map 3 | PERMANENT 4 | mikola 5 | raster 6 | Vector Map: inclined_Map1@PERMANENT 7 | Original scale from vector map: 1:1 8 | generated by v.to.rast 9 | v.to.rast --overwrite input="inclined_Map1@PERMANENT" layer="1" type\ 10 | ="point,line,area" output="inclined_Map" use="cat" value=1 memory=300 11 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/sqlite/sqlite.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/inclined/PERMANENT/sqlite/sqlite.db -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/vector/inclined_Map1/cidx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/inclined/PERMANENT/vector/inclined_Map1/cidx -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/vector/inclined_Map1/coor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/inclined/PERMANENT/vector/inclined_Map1/coor -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/vector/inclined_Map1/dbln: -------------------------------------------------------------------------------- 1 | 1/inclined_Map1|inclined_Map1|cat|$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db|sqlite 2 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/vector/inclined_Map1/head: -------------------------------------------------------------------------------- 1 | ORGANIZATION: 2 | DIGIT DATE: 3 | DIGIT NAME: mikola 4 | MAP NAME: 5 | MAP DATE: Thu Apr 28 16:28:55 2016 6 | MAP SCALE: 1 7 | OTHER INFO: 8 | ZONE: 0 9 | MAP THRESH: 0.000000 10 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/vector/inclined_Map1/hist: -------------------------------------------------------------------------------- 1 | COMMAND: v.edit map="inclined_Map1" layer="1" type="point,line,boundary,centroid" tool="create" threshold=-1,0,0 snap="no" 2 | GISDBASE: /home/mikola/grassdata 3 | LOCATION: inclined MAPSET: PERMANENT USER: mikola DATE: Thu Apr 28 16:28:55 2016 4 | --------------------------------------------------------------------------------- 5 | COMMAND: v.db.connect --quiet map="inclined_Map1" driver="sqlite" database="$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db" table="inclined_Map1" key="cat" layer="1" separator="pipe" 6 | GISDBASE: /home/mikola/grassdata 7 | LOCATION: inclined MAPSET: PERMANENT USER: mikola DATE: Thu Apr 28 16:28:55 2016 8 | --------------------------------------------------------------------------------- 9 | -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/vector/inclined_Map1/sidx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/inclined/PERMANENT/vector/inclined_Map1/sidx -------------------------------------------------------------------------------- /share/titan2d_examples/dem/inclined/PERMANENT/vector/inclined_Map1/topo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TITAN2D/titan2d/28ce6f4f8bb692559f881340a83e2632fa26ce9f/share/titan2d_examples/dem/inclined/PERMANENT/vector/inclined_Map1/topo -------------------------------------------------------------------------------- /share/titan2d_examples/inclined/Coulomb/input.py: -------------------------------------------------------------------------------- 1 | sim=TitanSimulation(overwrite_output=True) 2 | 3 | sim.setGIS( 4 | gis_format='GIS_GRASS', 5 | gis_main='../../dem', 6 | gis_sub='inclined', 7 | gis_mapset='PERMANENT', 8 | gis_map='inclined', 9 | ) 10 | 11 | sim.setScale( 12 | length_scale=100.0, 13 | gravity_scale=9.8, 14 | ) 15 | 16 | sim.setNumProp( 17 | AMR=True, 18 | number_of_cells_across_axis=48, 19 | order='First', 20 | ) 21 | sim.setMatModel( 22 | model='Coulomb', 23 | int_frict=37.0, 24 | bed_frict=27.0 25 | ) 26 | sim.addPile( 27 | pile_type='Cylinder', 28 | height=0.01, 29 | center=[0.2, 0.3], 30 | radii=[.02, 0.02], 31 | orientation=0.0, 32 | Vmagnitude=0.0, 33 | Vdirection=0.0, 34 | ) 35 | 36 | sim.setTimeProps( 37 | max_iter=1000, 38 | ) 39 | 40 | sim.setTimeSeriesOutput( 41 | vizoutput=('xdmf'), 42 | dtime=1.0, 43 | ) 44 | sim.setRestartOutput( 45 | enabled=True, 46 | diter=100, 47 | keep_all=True, 48 | keep_redundant_data=True, 49 | output_prefix='restart', 50 | ) 51 | 52 | #start simulation 53 | sim.run() 54 | -------------------------------------------------------------------------------- /share/titan2d_examples/inclined/Coulomb_MatMap/input.py: -------------------------------------------------------------------------------- 1 | sim=TitanSimulation(overwrite_output=True) 2 | 3 | sim.setGIS( 4 | gis_format='GIS_GRASS', 5 | gis_main='../../dem', 6 | gis_sub='inclined', 7 | gis_mapset='PERMANENT', 8 | gis_map='inclined', 9 | ) 10 | 11 | sim.setScale( 12 | length_scale=1.0, 13 | gravity_scale=9.8, 14 | ) 15 | 16 | sim.setNumProp( 17 | AMR=True, 18 | number_of_cells_across_axis=12, 19 | order='First', 20 | ) 21 | sim.setMatModel( 22 | model='Coulomb', 23 | int_frict=37.0, 24 | 25 | use_gis_matmap=True, 26 | bed_frict={ 27 | "Mat1":27.0, 28 | "Mat2":35.0, 29 | "Mat3":20.0, 30 | } 31 | ) 32 | sim.addPile( 33 | pile_type='Cylinder', 34 | height=0.01, 35 | center=[0.2, 0.2], 36 | radii=[.02, 0.02], 37 | orientation=0.0, 38 | Vmagnitude=0.0, 39 | Vdirection=0.0, 40 | ) 41 | 42 | sim.setTimeProps( 43 | max_iter=5000, 44 | ) 45 | 46 | sim.setTimeSeriesOutput( 47 | vizoutput=('xdmf'), 48 | dtime=1.0, 49 | ) 50 | 51 | sim.setRestartOutput( 52 | enabled=True, 53 | diter=200, 54 | keep_all=True, 55 | keep_redundant_data=True, 56 | output_prefix='restart', 57 | ) 58 | 59 | #start simulation 60 | sim.run() 61 | -------------------------------------------------------------------------------- /share/titan2d_examples/run_all_examples.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | wd=`pwd` 4 | titan=$wd/../../bin/titan 5 | 6 | #source enviroment variables if needed 7 | if [ -a "$wd/../../bin/titanvar" ]; then 8 | echo "loading titan2d enviroment variables" 9 | source "$wd/../../bin/titanvar" 10 | fi 11 | 12 | CORES_PER_SOCKET=`lscpu|grep "Core(s) per socket"|cut -d':' -f2-` 13 | SOCKETS=`lscpu|grep "Socket(s):"|cut -d':' -f2-` 14 | CORES_TO_USE=`expr $CORES_PER_SOCKET \* $SOCKETS` 15 | 16 | for d in Coulomb Coulomb_MatMap 17 | do 18 | echo $d 19 | cd inclined/$d 20 | echo "In directory: " `pwd` 21 | echo "Running:" $titan -nt $CORES_TO_USE input.py \>\& out_reg 22 | $titan -nt $CORES_TO_USE input.py >& out_reg 23 | cd $wd 24 | done 25 | 26 | for d in Coulomb Pouliquen_Forterre Voellmy_Salm Coulomb_with_stopping Coulomb_all_param_explicit Coulomb_FluxSrc_DischPlane Coulomb_GeoTIFF TwoPhases_Pitman_Le 27 | do 28 | echo $d 29 | cd colimafinemini/$d 30 | echo "In directory: " `pwd` 31 | echo "Running:" $titan -nt $CORES_TO_USE input.py \>\& out_reg 32 | $titan -nt $CORES_TO_USE input.py >& out_reg 33 | cd $wd 34 | done -------------------------------------------------------------------------------- /shippable.yml: -------------------------------------------------------------------------------- 1 | language: none 2 | build: 3 | pre_ci_boot: 4 | image_name: nsimakov/titan2d_bin_maker 5 | image_tag: centos7 6 | pull: true 7 | ci: 8 | - rsync -a /root/src/github.com/$REPO_FULL_NAME /home/centos/titan2d_wsp 9 | - chown -R centos:centos /home/centos/titan2d_wsp/titan2d 10 | - ls /home/centos/titan2d_wsp 11 | - ls /home/centos/titan2d_wsp/titan2d 12 | - su - centos -c "/home/centos/titan2d_wsp/titan2d/docker/utils/titan2d_bin_maker bootstrap_titan2d" 13 | - su - centos -c "/home/centos/titan2d_wsp/titan2d/docker/utils/titan2d_bin_maker install_titan2d" 14 | - su - centos -c "/home/centos/titan2d_wsp/titan2d/docker/utils/titan2d_bin_maker run_tests" 15 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for src/ directory 3 | # 4 | # $Id: Makefile.am 126 2007-06-07 19:46:32Z dkumar $ 5 | # 6 | 7 | SUBDIRS = header gisapi useful preproc datstr repartition adapt geoflow tecplot stochastic vectordatapreproc main 8 | #viewer2d 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/adapt/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for src/adapt directory 3 | # 4 | # $Id: Makefile.am 2 2003-08-13 19:26:11Z sorokine $ 5 | # 6 | 7 | noinst_LIBRARIES = libadapt.a 8 | 9 | libadapt_a_SOURCES = update_info_interp.C depchk.C \ 10 | refine2.C updatenei.C hadpt.C unrefine.C #update_order_interp.C 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/datstr/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for src/datstr directory 3 | # 4 | # $Id: Makefile.am 2 2003-08-13 19:26:11Z sorokine $ 5 | # 6 | 7 | noinst_LIBRARIES = libdatstr.a 8 | 9 | libdatstr_a_SOURCES = hashtab2.C element2.C elements_properties.C htflush.C Makefile.am node.C sfc.C 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/datstr/htflush.C: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: htflush.C 2 2003-08-13 19:26:11Z sorokine $ 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | # include 20 | #endif 21 | 22 | #include "../header/hpfem.h" 23 | 24 | void htflush(ElementsHashTable* ht_elem_ptr, NodeHashTable* ht_node_ptr, int option) 25 | { 26 | 27 | int i, j, k; 28 | Element* EmTemp; 29 | Node* NdTemp; 30 | unsigned KeyTemp[KEYLENGTH]; 31 | unsigned* keyP; 32 | void* p; 33 | int* dofP; 34 | double* sol; 35 | int e_buckets = ht_elem_ptr->get_no_of_buckets(); 36 | //int n_buckets = ht_node_ptr->get_no_of_buckets(); 37 | 38 | switch (option) 39 | { 40 | case 1: 41 | for(i = 0; i < ht_elem_ptr->elenode_.size(); i++) 42 | { 43 | if(ht_elem_ptr->status_[i]>=0) 44 | { 45 | ht_elem_ptr->elenode_[i].set_new_old(OLD); 46 | } 47 | } 48 | break; 49 | /*case 2: 50 | for(i = 0; i < n_buckets; i++) 51 | { 52 | entryp = *(ht_node_ptr->getbucketptr() + i); 53 | while (entryp) 54 | { 55 | NdTemp = (Node*) (entryp->value); 56 | //NdTemp->putinfo(INIT); 57 | 58 | entryp = entryp->next; 59 | } 60 | }*/ 61 | /*for(i = 0; i < e_buckets; i++) 62 | { 63 | entryp = *(ht_elem_ptr->getbucketptr() + i); 64 | while (entryp) 65 | { 66 | EmTemp = (Element*) (entryp->value); 67 | for(j = 0; j < 8; j++) 68 | { 69 | EmTemp->put_recv_flag(j, 0); 70 | EmTemp->put_send_flag(j, 0); 71 | } 72 | entryp = entryp->next; 73 | } 74 | }*/ 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/datstr/sfc.C: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | *******************************************************************/ 15 | 16 | #include "../header/sfc.h" 17 | 18 | SFC_Key sfc_key_null=0; 19 | SFC_Key sfc_key_zero=0; 20 | -------------------------------------------------------------------------------- /src/geoflow/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for src/geoflow directory 3 | # 4 | # $Id: Makefile.am 218 2009-10-22 14:38:24Z dkumar $ 5 | # 6 | 7 | noinst_LIBRARIES = libgeoflow.a 8 | #predict.f eigen.f getcoef.f correct.f drag_model.f sgn.f 9 | libgeoflow_a_SOURCES = element_weight.C \ 10 | edge_states.C get_coef_and_eigen.C rnr.h slopes.C \ 11 | move_data.C setup_geoflow.C integrators.C stats.C flux_srcs.C 12 | 13 | #integrators.$(OBJEXT):CXXFLAGS +=-I/opt/intel/advisor_xe/include -qopt-report=5 -qopt-report-phase=vec 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/geoflow/element_weight.C: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: element_weight.C 128 2007-06-07 19:51:52Z dkumar $ 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | # include 20 | #endif 21 | 22 | #include "../header/hpfem.h" 23 | 24 | -------------------------------------------------------------------------------- /src/geoflow/rnr.h: -------------------------------------------------------------------------------- 1 | C******************************************************************* 2 | C* Copyright (C) 2003 University at Buffalo 3 | C* 4 | C* This software can be redistributed free of charge. See COPYING 5 | C* file in the top distribution directory for more details. 6 | C* 7 | C* This software is distributed in the hope that it will be useful, 8 | C* but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | C* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | C* 11 | C* Author: 12 | C* Description: 13 | C* 14 | C******************************************************************* 15 | C* $Id: rnr.h 2 2003-08-13 19:26:11Z sorokine $ 16 | C*/ 17 | 18 | implicit none 19 | c X will be the down-slope direction -- keep consistent with savage 20 | c for now, flat surface 21 | 22 | double precision half,pi 23 | 24 | parameter (half=0.5d0, pi=3.1415926535897931) 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/geoflow/slopes.C: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: slopes.C 128 2007-06-07 19:51:52Z dkumar $ 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | # include 20 | #endif 21 | 22 | #include "../header/hpfem.h" 23 | #include "../header/geoflow.h" 24 | 25 | void slopes(ElementsHashTable* El_Table, NodeHashTable* NodeTable, MatProps* matprops_ptr) 26 | { 27 | int i; 28 | //-------------------go through all the elements of the subdomain------------------------ 29 | //-------------------and -------------------------- 30 | 31 | /* mdj 2007-02 */ 32 | //#pragma omp parallel for private(currentPtr,Curr_El) 33 | for(ti_ndx_t ndx = 0; ndx < El_Table->size(); ndx++) 34 | { 35 | if(El_Table->adapted_[ndx] > 0)//if this element does not belong on this processor don't involve!!! 36 | { 37 | El_Table->elenode_[ndx].get_slopes(El_Table, NodeTable, matprops_ptr->gamma); 38 | } 39 | } 40 | return; 41 | } 42 | -------------------------------------------------------------------------------- /src/gisapi/GisAscFile.C: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: GisAscFile.C 224 2011-12-04 20:49:23Z dkumar $ 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | # include 20 | #endif 21 | 22 | #ifdef WIN32 23 | #pragma warning ( disable: 4786 ) 24 | #endif 25 | #include "GisAscFile.h" 26 | 27 | // -- Constructor 28 | 29 | GisAscFile::GisAscFile(const string & name, const char *mode) : 30 | mode_(mode) 31 | { 32 | const char *filename = name.c_str(); 33 | long rw_flag = 0; 34 | if(mode_ == string("r")) 35 | //file_.open ( filename, ios_base::in ); 36 | file_.open(filename, ios::in); 37 | else 38 | //file_.open ( filename, ios_base::out ); 39 | file_.open(filename, ios::out); 40 | // if ( ! file_.good() ) 41 | } 42 | 43 | void GisAscFile::rewind() 44 | { 45 | if(file_.good()) 46 | { 47 | if(mode_ == string("r")) //valid only for reading ?? 48 | file_.seekg(0, ios::beg); 49 | } 50 | } 51 | 52 | bool GisAscFile::findString(const string & toFindString) 53 | { 54 | bool stringFound = false; 55 | if(file_.good()) 56 | { 57 | string inString; 58 | for(;;) 59 | { 60 | file_ >> inString; 61 | if(inString == string(toFindString)) 62 | { 63 | stringFound = true; 64 | break; 65 | } 66 | } 67 | } 68 | return stringFound; 69 | } 70 | -------------------------------------------------------------------------------- /src/gisapi/GisAscFile.h: -------------------------------------------------------------------------------- 1 | #ifndef GisAscFile_H 2 | #define GisAscFile_H 3 | #include 4 | #include 5 | #include 6 | using namespace std; 7 | 8 | class GisAscFile 9 | { 10 | public: 11 | 12 | GisAscFile(const string & name, const char *mode = "r"); 13 | 14 | virtual ~ GisAscFile() 15 | { 16 | } 17 | 18 | bool good() 19 | { 20 | return file_.good(); 21 | } 22 | 23 | void getLine(char *outChar, int nChar, char termChar) //'\n' = 0x0A 24 | { 25 | file_.getline(outChar, nChar, termChar); 26 | } 27 | 28 | void getLine(char *outChar, int nChar) 29 | { 30 | file_.getline(outChar, nChar, '\n'); 31 | } 32 | 33 | void getLine(string & outString) 34 | { 35 | getline(file_, outString); 36 | } 37 | 38 | void getChar(char *outChar) 39 | { 40 | file_.read(outChar, 1); 41 | } 42 | 43 | void getAscInt(int &intValue) 44 | { 45 | file_ >> intValue; 46 | } 47 | 48 | void getAscDouble(double &doubleValue) 49 | { 50 | file_ >> doubleValue; 51 | } 52 | 53 | void getString(string & rString) 54 | { 55 | file_ >> rString; 56 | } 57 | 58 | void rewind(); 59 | 60 | string mode() 61 | { 62 | return mode_; 63 | } 64 | 65 | bool findString(const string & toFindString); 66 | 67 | protected: 68 | 69 | // -- File pointer 70 | 71 | fstream file_; 72 | string mode_; 73 | 74 | private: 75 | 76 | // No copy allowed 77 | GisAscFile(const GisAscFile &); 78 | GisAscFile & operator=(const GisAscFile &); 79 | }; 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /src/gisapi/GisCats.C: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: GisCats.C 224 2011-12-04 20:49:23Z dkumar $ 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | # include 20 | #endif 21 | 22 | #ifdef WIN32 23 | #pragma warning ( disable: 4786 ) 24 | #endif 25 | 26 | #include "GisCats.h" 27 | #include "GisAscFile.h" 28 | 29 | void removeAllWhite(std::string &str) 30 | { 31 | 32 | std::string temp; 33 | for(unsigned int i = 0; i < str.length(); i++) 34 | if(str[i] != ' ') 35 | temp += str[i]; 36 | str = temp; 37 | } 38 | 39 | GisCats::GisCats(const string & name) 40 | { 41 | _status = false; 42 | GisAscFile catsFile(name); 43 | if(catsFile.good()) 44 | { 45 | char charText[200]; 46 | catsFile.getLine(charText, 200, '#'); //# 47 | catsFile.getAscInt(_ncats); // number of categories 48 | catsFile.getLine(charText, 200); //categories 49 | catsFile.getLine(charText, 200); //Geology or Empty line 50 | catsFile.getLine(charText, 200); //Empty line 51 | catsFile.getLine(charText, 200); //0.00 0.00 0.00 0.00 52 | 53 | while (catsFile.good()) 54 | { 55 | string catName; 56 | int catNumber; 57 | catsFile.getAscInt(catNumber); //category number 58 | catsFile.getLine(charText, 40, ':'); 59 | catsFile.getLine(charText, 200); // read the remaining line 60 | catName = charText; 61 | removeAllWhite(catName); 62 | _catnames[catNumber] = catName; 63 | if(catNumber == _ncats) 64 | break; 65 | } 66 | //this->print(); 67 | _status = true; 68 | } 69 | } 70 | 71 | void GisCats::print() 72 | { 73 | map::iterator i; 74 | 75 | for(i = _catnames.begin(); i != _catnames.end(); i++) 76 | cout << (*i).first << " " << (*i).second << endl; 77 | } 78 | 79 | -------------------------------------------------------------------------------- /src/gisapi/GisCats.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: GisCats.h 224 2011-12-04 20:49:23Z dkumar $ 16 | */ 17 | 18 | #ifndef GisCats_H 19 | #define GisCats_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | using namespace std; 26 | 27 | class GisCats 28 | { 29 | public: 30 | 31 | GisCats(const string & name); 32 | 33 | virtual ~ GisCats() 34 | { 35 | } 36 | 37 | bool good() 38 | { 39 | return _status; 40 | } 41 | 42 | int mumberOfCats() 43 | { 44 | return _ncats; 45 | } 46 | 47 | const char *category(int index) 48 | { 49 | return _catnames[index].c_str(); 50 | } 51 | 52 | void print(); 53 | 54 | protected: 55 | 56 | bool _status; 57 | 58 | int _ncats; 59 | map _catnames; 60 | 61 | private: 62 | 63 | // No copy allowed 64 | GisCats(const GisCats &); 65 | GisCats & operator=(const GisCats &); 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /src/gisapi/GisColors.C: -------------------------------------------------------------------------------- 1 | #ifdef WIN32 2 | #pragma warning ( disable: 4786 ) 3 | #endif 4 | 5 | #include "GisColors.h" 6 | #include "GisAscFile.h" 7 | 8 | GisColors::GisColors(const string & name) 9 | { 10 | _status = false; 11 | GisAscFile colsFile(name); 12 | if(colsFile.good()) 13 | { 14 | char charText[200]; 15 | int fcolor, lcolor; 16 | int i; 17 | 18 | for(i = 0; i <= 255; i++) 19 | _red[i] = _green[i] = _blue[i] = 0; 20 | 21 | colsFile.getLine(charText, 200, '%'); // % 0 255 22 | colsFile.getAscInt(fcolor); // first color 23 | colsFile.getAscInt(lcolor); // last color 24 | 25 | fcolor = (fcolor < 0) ? 0 : fcolor; 26 | lcolor = (lcolor > 255) ? 255 : lcolor; 27 | for(i = fcolor; i <= lcolor; i++) 28 | { 29 | int colNumber, red, green, blue; 30 | colsFile.getAscInt(colNumber); //color number 31 | if(i != colNumber) 32 | { 33 | _status = false; 34 | return; 35 | } 36 | colsFile.getLine(charText, 20, ':'); 37 | colsFile.getAscInt(red); 38 | colsFile.getChar(&charText[0]); 39 | if(charText[0] == 0x0a) 40 | { 41 | _green[i] = _blue[i] = _red[i] = red; 42 | continue; 43 | } 44 | colsFile.getAscInt(green); 45 | colsFile.getLine(charText, 20, ':'); 46 | colsFile.getAscInt(blue); 47 | _green[i] = green; 48 | _blue[i] = blue; 49 | _red[i] = red; 50 | } 51 | _status = true; 52 | } 53 | } 54 | 55 | void GisColors::getColor(int index, unsigned char &red, unsigned char &green, unsigned char &blue) 56 | { 57 | if(index >= 0 && index <= 255) 58 | { 59 | green = _green[index]; 60 | blue = _blue[index]; 61 | red = _red[index]; 62 | } 63 | else 64 | { 65 | green = blue = red = 0; 66 | } 67 | } 68 | 69 | void GisColors::print() 70 | { 71 | //cout << colNumber << " " << red << " " << green << " " << blue << endl; 72 | // 73 | // for( i = _catnames.begin(); i != _catnames.end(); i++) 74 | // cout << (*i).first << " " << (*i).second << endl; 75 | } 76 | -------------------------------------------------------------------------------- /src/gisapi/GisColors.h: -------------------------------------------------------------------------------- 1 | #ifndef GisColors_H 2 | #define GisColors_H 3 | 4 | #include 5 | #include 6 | #include 7 | using namespace std; 8 | 9 | class GisColors 10 | { 11 | public: 12 | 13 | GisColors(const string & name); 14 | 15 | virtual ~ GisColors() 16 | { 17 | } 18 | 19 | bool good() 20 | { 21 | return _status; 22 | } 23 | 24 | void getColor(int index, unsigned char &red, unsigned char &green, unsigned char &blue); 25 | 26 | void print(); 27 | 28 | protected: 29 | 30 | bool _status; 31 | unsigned int _red[256]; 32 | unsigned int _green[256]; 33 | unsigned int _blue[256]; 34 | 35 | private: 36 | 37 | // No copy allowed 38 | GisColors(const GisColors &); 39 | GisColors & operator=(const GisColors &); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/gisapi/GisGrid.h: -------------------------------------------------------------------------------- 1 | #ifndef GisGrid_H 2 | #define GisGrid_H 3 | 4 | #define GISGRID_MAXFLOAT 1.0e31 5 | #define GISGRID_BIGFLOAT 1.0e32 6 | 7 | #include 8 | using namespace std; 9 | 10 | class GisTriOut; 11 | 12 | class GisGrid 13 | { 14 | public: 15 | 16 | GisGrid(); 17 | 18 | virtual ~ GisGrid() 19 | { 20 | } 21 | 22 | void setNumRowsCols(int nRows, int nCols); 23 | 24 | void setNumRows(int nRows); 25 | 26 | void setNumCols(int nCols); 27 | 28 | void setBox(double xMin, double yMin, double xMax, double yMax) 29 | { 30 | xMin_ = xMin; 31 | yMin_ = yMin; 32 | xMax_ = xMax; 33 | yMax_ = yMax; 34 | } 35 | 36 | void setRes(float res); 37 | 38 | void setResX(float res); 39 | 40 | double getResX() 41 | { 42 | return resX_; 43 | } 44 | 45 | void setResY(float res); 46 | 47 | double getResY() 48 | { 49 | return resY_; 50 | } 51 | 52 | double deltaX() 53 | { 54 | return (xMax_ - xMin_); 55 | } 56 | 57 | double deltaY() 58 | { 59 | return (yMax_ - yMin_); 60 | } 61 | 62 | double noDataValue() 63 | { 64 | return noData_; 65 | } 66 | 67 | void noDataValue(double doubleVal) 68 | { 69 | noData_ = doubleVal; 70 | } 71 | 72 | void initGrid(); 73 | 74 | void setMax(GisTriOut & tri, int simVar); 75 | // simVar: 1 - Pile height; 2 - Velocity"; 76 | 77 | double get(int row, int col); 78 | 79 | int getRow(double y); 80 | 81 | int getCol(double x); 82 | 83 | double getY(int row); 84 | 85 | double getX(int col); 86 | 87 | void set(int row, int col, float floatVal); 88 | 89 | void smooth3(); 90 | 91 | void print(); 92 | 93 | // protected: 94 | 95 | double resX_; 96 | double resY_; 97 | double xMin_; 98 | double yMin_; 99 | double xMax_; 100 | double yMax_; 101 | double noData_; 102 | int nCols_; 103 | int nRows_; 104 | 105 | vector gisGrid_; 106 | 107 | private: 108 | 109 | }; 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /src/gisapi/GisLabels.C: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: GisLabels.C 110 2005-02-02 00:09:54Z namikawa $ 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | # include 20 | #endif 21 | 22 | #ifdef WIN32 23 | #pragma warning ( disable: 4786 ) 24 | #endif 25 | 26 | #include "GisLabels.h" 27 | #include "GisSPRFile.h" 28 | 29 | GisLabels::GisLabels(const string& name) 30 | { 31 | _status = false; 32 | _nlabels = 0; 33 | GisSPRFile sprFile(name); 34 | if(sprFile.good()) 35 | { 36 | if(sprFile.readLabels(_labelXs, _labelYs, _labelStrings)) 37 | { 38 | _nlabels = _labelStrings.size(); 39 | _status = true; 40 | } 41 | 42 | vector::iterator i; 43 | map::iterator j; 44 | for(i = _labelStrings.begin(); i != _labelStrings.end(); i++) 45 | { 46 | j = _labelIndxs.find(*i); 47 | if(j == _labelIndxs.end()) 48 | _labelIndxs[(*i)] = _labelIndxs.size(); 49 | } 50 | } 51 | } 52 | 53 | bool GisLabels::getLabel(int nlabel, string& labelString, double& x, double& y) 54 | { 55 | if(nlabel < _nlabels) 56 | { 57 | labelString = _labelStrings[nlabel]; 58 | x = _labelXs[nlabel]; 59 | y = _labelYs[nlabel]; 60 | return true; 61 | } 62 | return false; 63 | } 64 | 65 | int GisLabels::getIndex(string& labelStr) 66 | { 67 | map::iterator i; 68 | i = _labelIndxs.find(labelStr); 69 | if(i != _labelIndxs.end()) 70 | return ((*i).second) + 1; 71 | 72 | return 0; 73 | } 74 | 75 | void GisLabels::print() 76 | { 77 | vector::iterator i; 78 | vector::iterator j; 79 | vector::iterator k; 80 | for(i = _labelStrings.begin(), j = _labelXs.begin(), k = _labelYs.begin(); 81 | i != _labelStrings.end(), j != _labelXs.end(), k != _labelYs.end(); i++, j++, k++) 82 | cout << (*i) << " " << (*j) << " " << (*k) << endl; 83 | 84 | map::iterator m; 85 | for(m = _labelIndxs.begin(); m != _labelIndxs.end(); m++) 86 | cout << (*m).first << " " << (*m).second << endl; 87 | 88 | } 89 | 90 | -------------------------------------------------------------------------------- /src/gisapi/GisLabels.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: GisLabels.h 110 2005-02-02 00:09:54Z namikawa $ 16 | */ 17 | 18 | #ifndef GisLabels_H 19 | #define GisLabels_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | using namespace std; 27 | 28 | class GisLabels 29 | { 30 | public: 31 | 32 | GisLabels(const string& name); 33 | 34 | virtual ~GisLabels() 35 | { 36 | } 37 | 38 | bool good() 39 | { 40 | return _status; 41 | } 42 | 43 | int numberOfLabels() 44 | { 45 | return _nlabels; 46 | } 47 | 48 | bool getLabel(int nlabel, string& labelString, double& x, double& y); 49 | 50 | int getIndex(string& labelStr); 51 | 52 | void print(); 53 | 54 | protected: 55 | 56 | bool _status; 57 | 58 | int _nlabels; 59 | vector _labelStrings; 60 | vector _labelXs; 61 | vector _labelYs; 62 | map _labelIndxs; 63 | 64 | private: 65 | 66 | // No copy allowed 67 | GisLabels(const GisLabels&); 68 | GisLabels& operator=(const GisLabels&); 69 | }; 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /src/gisapi/GisSPRFile.h: -------------------------------------------------------------------------------- 1 | #ifndef GisSPRFile_H 2 | #define GisSPRFile_H 3 | 4 | #include 5 | #include 6 | #include "GisAscFile.h" 7 | #include "GisLines.h" 8 | 9 | class GisSPRFile: public GisAscFile 10 | { 11 | public: 12 | 13 | GisSPRFile(const string& name, const char* mode = "r"); 14 | 15 | virtual ~GisSPRFile() 16 | { 17 | } 18 | 19 | bool gotoPOINTSSection(); 20 | bool gotoLINESSection(); 21 | 22 | bool readLabels(vector& x, vector& y, vector& labelStr); 23 | 24 | bool readFirstLine(vector& x, vector& y); 25 | 26 | bool readNextLine(vector& x, vector& y); 27 | 28 | bool readINFOSection(); 29 | 30 | bool gotoSection(string& sectionName); 31 | 32 | protected: 33 | 34 | string _sepStr; 35 | 36 | private: 37 | 38 | // No copy allowed 39 | GisSPRFile(const GisSPRFile&); 40 | GisSPRFile& operator=(const GisSPRFile&); 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/gisapi/GisTriFile.h: -------------------------------------------------------------------------------- 1 | #ifndef GisTriFile_H 2 | #define GisTriFile_H 3 | 4 | #include 5 | #include "GisBinFile.h" 6 | 7 | class GisTriOut 8 | { 9 | public: 10 | 11 | GisTriOut() 12 | { 13 | } 14 | 15 | virtual ~GisTriOut() 16 | { 17 | } 18 | 19 | double x0_; 20 | double y0_; 21 | float z0_; 22 | double x1_; 23 | double y1_; 24 | float z1_; 25 | double x2_; 26 | double y2_; 27 | float z2_; 28 | float pHeight_; 29 | float xmom_; 30 | float ymom_; 31 | 32 | int key1_; 33 | int key2_; 34 | int gen_; 35 | int istriedge_; 36 | 37 | double xMin(); 38 | double xMax(); 39 | double yMin(); 40 | double yMax(); 41 | 42 | bool contains(double x, double y); 43 | void print(); 44 | 45 | protected: 46 | 47 | private: 48 | 49 | }; 50 | 51 | class GisTriFile: public GisBinFile 52 | { 53 | public: 54 | 55 | GisTriFile(const string& name, const char* mode = "r"); 56 | 57 | virtual ~GisTriFile() 58 | { 59 | } 60 | 61 | bool readTimeStepInfo(); 62 | 63 | int versionNumber(); 64 | // return -1, if error. 65 | 66 | bool readTriData(GisTriOut& triOut); 67 | 68 | int numTri_; 69 | int timeStep_; 70 | float simTime_; 71 | float pileMin_; 72 | float pileMax_; 73 | float xMomMin_; 74 | float xMomMax_; 75 | float yMomMin_; 76 | float yMomMax_; 77 | double xMin_; 78 | double xMax_; 79 | double yMin_; 80 | double yMax_; 81 | float elevMin_; 82 | float elevMax_; 83 | float maxVel_; 84 | 85 | protected: 86 | 87 | private: 88 | 89 | // No copy allowed 90 | GisTriFile(const GisTriFile&); 91 | GisTriFile& operator=(const GisTriFile&); 92 | }; 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /src/gisapi/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for src/gisapi directory 3 | # 4 | # $Id: Makefile.am 233 2012-03-27 18:30:40Z dkumar $ 5 | # 6 | 7 | noinst_LIBRARIES = libgisapi.a 8 | 9 | libgisapi_a_SOURCES = GisApi.C GisAscFile.C GisBinFile.C GisCats.C \ 10 | GisRasterHdr.C GisColors.C GisLines.C GisLabels.C GisSPRFile.C \ 11 | GisGrid.C GisTriFile.C \ 12 | GisApi.h GisAscFile.h GisBinFile.h GisCats.h GisRasterHdr.h \ 13 | GisColors.h GisLines.h GisLabels.h GisSPRFile.h GisGrid.h GisTriFile.h 14 | 15 | if WITH_GDAL 16 | libgisapi_a_SOURCES += GdalApi.cc gmfg_GdalApi.h 17 | endif 18 | -------------------------------------------------------------------------------- /src/gisapi/gmfg_GdalApi.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: Geophysical Mass Flow Group, University at Buffalo 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: $ 16 | */ 17 | 18 | #ifndef GMFG_GDALAPI_H 19 | #define GMFG_GDALAPI_H 20 | int 21 | Initialize_GDAL_data(const char *fullGisPath); 22 | int 23 | load_GDAL_data(); 24 | 25 | #endif // GMFG_GDALAPI_H 26 | -------------------------------------------------------------------------------- /src/header/FileFormat.h: -------------------------------------------------------------------------------- 1 | /* right now this file is used by the preprocessor (initial grid generator) 2 | and by ../main/datread.C Currently the hpfem must be recompiled to 3 | switch between the different types (text, binary, and coming soon... HDF) 4 | of initial grid files. It is desirable to change the preprocessor so 5 | that the different types of initial grid files have different extensions. 6 | This would allow datread to DETECT the file type, and (with if statements) 7 | load it automatically (without recompiling) */ 8 | 9 | /* choose to pass funky directly or write an intermediate binary or text file 10 | note that you can choose to write the intermediate files in addition passing 11 | funky directly... this is to aid in debugging */ 12 | #define PASSFUNKY 13 | //#define WRITEFUNKYBIN 14 | //#define WRITEFUNKYDAT 15 | 16 | /* automatic choice of which (if any) intermediate files to read depends on 17 | which intermediate files you chose to write... if you chose not to pass 18 | funky directly and not to write any, it tries to read an OLD text file 19 | named funky.dat */ 20 | #ifndef PASSFUNKY 21 | #ifdef WRITEFUNKYBIN 22 | #define READFUNKYBIN 23 | #else 24 | #define READFUNKYDAT 25 | #endif 26 | #endif 27 | 28 | /* choose what format to write/read hpfem input files funkyxxxx.inp in, your 29 | choices are: 30 | HDF (Hierarchical Data Format... this is the smallest) not yet implemnted 31 | BIN (binary... in case HDF library is not installed) 32 | TXT (text... this is the largest but it's useful in debugging) 33 | Note that in all three cases the data file is named funkyxxxx.inp (where 34 | xxxx is the process id). If more than one is defined precedence is given 35 | to HDF then BIN then TXT. 36 | Note that when neither HDFINPUT nor BININPUT is defined the default is to 37 | use text input (it is not necessary to define TXTINPUT) 38 | */ 39 | //#define HDFINPUT //not yet implemented 40 | #define BININPUT 41 | //#define TXTINPUT 42 | 43 | // options specific to BIN (binary) files 44 | //#define WRITEDOUBLEASFLOAT //this can affect the solution but reduces file size 45 | //#define DEBUGFUNKYBIN 46 | //#define DEBUGBIN2 47 | -------------------------------------------------------------------------------- /src/header/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for src/header directory 3 | # 4 | # $Id: Makefile.am 233 2012-03-27 18:30:40Z dkumar $ 5 | # 6 | 7 | DIST_OTHER = titan_config.h.in 8 | 9 | noinst_HEADERS = blas.h constant.h extfun.h geoflow.h hpfem.h properties.h \ 10 | refined_neighbor_info.h struct.h element2.h exvar.h \ 11 | hashtab.h node.h scale.h flux_srcs.h hd5calls.h 12 | -------------------------------------------------------------------------------- /src/header/blas.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: blas.h 2 2003-08-13 19:26:11Z sorokine $ 16 | */ 17 | 18 | #ifdef SUNOS 19 | extern "C" void dcopy_(int*, double*, int*, double*, int*); 20 | extern "C" double ddot_(int*, double*, int*, double*, int*); 21 | extern "C" void tri_(double*, int*, int*); 22 | extern "C" void rhsub_(double*,double*, int*, int*, double*); 23 | extern "C" void schur5_(double*, double*, double* , double*, int*, int*, 24 | int*, int*, double*, double*, double*, double*); 25 | #endif 26 | #ifdef IBMSP 27 | extern "C" void dcopy(int*, double*, int*, double*, int*); 28 | extern "C" double ddot(int*, double*, int*, double*, int*); 29 | extern "C" void tri(double*, int*, int*); 30 | extern "C" void rhsub(double*,double*, int*, int*, double*); 31 | extern "C" void schur5(double*, double*, double* , double*, int*, int*, 32 | int*, int*, double*, double*, double*, double*); 33 | #endif 34 | 35 | #ifdef CRAY 36 | extern "C" void DCOPY(int*, double*, int*, double*, int*); 37 | extern "C" double DDOT(int*, double*, int*, double*, int*); 38 | extern "C" void TRI(double*, int*, int*); 39 | extern "C" void RHSUB(double*,double*, int*, int*, double*); 40 | extern "C" void SCHUR5(double*, double*, double* , double*, int*, int*, 41 | int*, int*, double*, double*, double*, double*); 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /src/header/elenode.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * File: elenode.hpp 3 | * Author: mikola 4 | * 5 | * Created on September 2, 2015, 12:56 PM 6 | */ 7 | 8 | #ifndef ELENODE_HPP 9 | #define ELENODE_HPP 10 | 11 | //this header should be use instead of node.h element.h hashtab.h 12 | #define __STDC_FORMAT_MACROS 13 | #include 14 | 15 | 16 | #include "sfc.h" 17 | #include "tivector.h" 18 | 19 | #include "node.h" 20 | #include "element2.h" 21 | #include "hashtab.h" 22 | #include "node_inline.h" 23 | #include "element_inline.h" 24 | #include "elements_properties_inline.hpp" 25 | #endif /* ELENODE_HPP */ 26 | 27 | -------------------------------------------------------------------------------- /src/header/exvar.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: exvar.h 2 2003-08-13 19:26:11Z sorokine $ 16 | */ 17 | 18 | #include "ticore/omp_mpi.hpp" 19 | 20 | #ifdef USE_MPI 21 | extern MPI_Datatype NSOLTYPE; 22 | extern MPI_Datatype ELEMTYPE; 23 | extern MPI_Datatype NEIGHTYPE; 24 | extern MPI_Datatype LB_VERT_TYPE; 25 | #endif 26 | -------------------------------------------------------------------------------- /src/header/flux_srcs.h: -------------------------------------------------------------------------------- 1 | #ifndef __FLUX_SRCS__ 2 | #define __FLUX_SRCS__ 3 | 4 | //! this fuction flags cells with active and passive flux sources (not to be confuesed with inter-cell numerical flux). It is initally called along with init_piles, then it is called everytime after adaptation is triggered by a begining of a flux-source. 5 | extern void mark_flux_region(ElementsHashTable *ElmTable, NodeHashTable *NodeTable, MatProps *matprops, FluxProps *fluxprops, 6 | TimeProps *timeprops); 7 | 8 | //! this function triggers refinement when a flux sources starts adding material. TODO currently this is crudely implemented. Needs improvement, keith's idea of using binary flag is a good idea. 9 | extern void adapt_fluxsrc_region(ElementsHashTable *ElemTable, NodeHashTable *NodeTable, MatProps *matprops, 10 | PileProps *pileprops, FluxProps *fluxprops, TimeProps *timeprops, double dt, int myid, 11 | int adaptflag); 12 | 13 | //! this fuction calculates the flux contribution of the current cell based on its position relative to the source center and outflow-profie. 14 | extern double calc_flux(Element *EmTemp, NodeHashTable *NodeTable, FluxProps *fluxprops, TimeProps *timeprops); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/header/hadapt_inline.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2015 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | */ 16 | #ifndef HADAPT_INLINE_HPP 17 | #define HADAPT_INLINE_HPP 18 | 19 | #include "hadapt.h" 20 | 21 | 22 | inline int HAdaptUnrefine::check_unrefinement(ti_ndx_t ndx, double target) 23 | { 24 | int unrefine_flag = 1; 25 | 26 | // put in good element check here!!! 27 | //if((if_pile_boundary(El_Table,target))|| 28 | // (if_source_boundary(El_Table))) 29 | //if((state_vars[0] >= target)||(Influx[0]>0.0)) 30 | if(adapted_[ndx] != NOTRECADAPTED) 31 | //This rules out NEWFATHERs, NEWSONs, BUFFERs, GHOSTs, TOBEDELETEDs, and OLDFATERs 32 | //This is a redundant check but is is better to be safe than sorry 33 | return (0); 34 | 35 | for(int i = 0; i < 8; i++) 36 | { 37 | if(((neigh_proc_[i][ndx] != myprocess_[ndx]) && (neigh_proc_[i][ndx] >= 0) && (generation_[ndx] <= 0)) || (neigh_gen_[i][ndx] > generation_[ndx])) 38 | return (0); 39 | } 40 | 41 | return (1); 42 | } 43 | 44 | 45 | #endif /* ELEMENTS_PROPERTIES_INLINE_HPP */ 46 | 47 | -------------------------------------------------------------------------------- /src/header/hpfem.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: hpfem.h 206 2009-01-26 17:32:10Z dkumar $ 16 | */ 17 | 18 | //modifed 2003/08/29 11:29:35 by kdalbey 19 | #define SUNOS //definition for gmake architecture 20 | #define TOPO_DATA 21 | 22 | #include "ticore/omp_mpi.hpp" 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | using namespace std; 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "titan2d.h" 38 | #include "ticore.hpp" 39 | 40 | #include "properties.h" 41 | #include "stats.hpp" 42 | #include "elenode.hpp" 43 | #include "extfun.h" 44 | #include "geoflow.h" 45 | #include "scale.h" 46 | #include "../gisapi/GisApi.h" 47 | #include "../useful/useful_lib.h" 48 | #include "FileFormat.h" 49 | #include "flux_srcs.h" 50 | 51 | #include "titan2d_utils.h" 52 | 53 | //! construct_el is a friend function of the Element class that fills an element with information it receives in a variable of the ElemPack class from an MPI call 54 | void construct_el(Element* newelement, ElemPack* elem2, NodeHashTable* HT_Node_Ptr, int myid, double* e_error); 55 | 56 | #undef CRAY 57 | 58 | -------------------------------------------------------------------------------- /src/header/outline.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | */ 16 | 17 | #ifndef OUTLINE_H 18 | #define OUTLINE_H 19 | 20 | 21 | #endif /* OUTLINE_H */ 22 | 23 | -------------------------------------------------------------------------------- /src/header/scale.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: scale.h 2 2003-08-13 19:26:11Z sorokine $ 16 | */ 17 | 18 | #ifndef SCALE_H 19 | #define SCALE_H 20 | struct ScaleValues 21 | { 22 | double lengthscale; 23 | double heightscale; 24 | double gravityscale; 25 | 26 | ScaleValues() 27 | { 28 | ifstream inDatafile("scale.data", ios::in); 29 | if(inDatafile.fail()) 30 | { 31 | // assume no scaling then... 32 | lengthscale = 1; 33 | heightscale = 1; 34 | gravityscale = 1; 35 | } 36 | inDatafile >> lengthscale; 37 | if(lengthscale < GEOFLOW_TINY) 38 | lengthscale = 1; 39 | inDatafile >> heightscale; 40 | if(heightscale < GEOFLOW_TINY) 41 | heightscale = 1; 42 | inDatafile >> heightscale; 43 | if(gravityscale < GEOFLOW_TINY) 44 | gravityscale = 1; 45 | 46 | inDatafile.close(); 47 | } 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/header/ticore/omp_mpi.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2016 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: mpi and openmp utils and helpers should be include instead of mpi.h and omp.h 13 | * 14 | ******************************************************************* 15 | */ 16 | 17 | #ifndef SRC_HEADER_TICORE_OMP_MPI_HPP_ 18 | #define SRC_HEADER_TICORE_OMP_MPI_HPP_ 19 | 20 | #ifdef _OPENMP 21 | #include 22 | 23 | #define IF_OMP(statement) statement 24 | 25 | #else 26 | 27 | #define IF_OMP(statement) 28 | #define omp_get_thread_num() 0 29 | #define omp_get_max_threads() 1 30 | 31 | #endif 32 | 33 | #ifdef USE_MPI 34 | 35 | #include 36 | #define IF_MPI(statement) statement 37 | 38 | #else 39 | 40 | #define IF_MPI(statement) 41 | 42 | #define MPI_Comm_size(comm_world, numprocs) *(numprocs)=1 43 | #define MPI_Comm_rank(comm_world, myid) *(myid)=0 44 | 45 | #define __STDC_FORMAT_MACROS 46 | #include 47 | #include 48 | 49 | inline double MPI_Wtime() 50 | { 51 | int64_t t=std::chrono::duration_cast 52 | (std::chrono::high_resolution_clock::now().time_since_epoch()).count(); 53 | return (double)t*0.000001; 54 | } 55 | 56 | #endif 57 | 58 | #endif /* SRC_HEADER_TICORE_OMP_MPI_HPP_ */ 59 | -------------------------------------------------------------------------------- /src/header/ticore/tisearch.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2015 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | */ 16 | 17 | #ifndef SRC_HEADER_TICORE_TISEARCH_HPP_ 18 | #define SRC_HEADER_TICORE_TISEARCH_HPP_ 19 | 20 | #include "../constant.h" 21 | #include "../tivector.h" 22 | 23 | 24 | 25 | /** 26 | * find an index i such that A[i-1] 29 | ti_ndx_t find_insertion_spot(const ti_ndx_t N, const T* RESTRICT A, const T b) 30 | { 31 | //@TODO do binary tree search 32 | if(N==0)return 0; 33 | 34 | if(b HASHTABLE_LOOKUP_LINSEARCH) 54 | { 55 | if(b>A[i1]) 56 | { 57 | i0 = i1 + 1; 58 | i1 = (i0 + i2) / 2; 59 | } 60 | else 61 | { 62 | i2 = i1; 63 | i1 = (i0 + i2) / 2; 64 | } 65 | } 66 | for(i = i0; i <= i2; i++) 67 | { 68 | if(A[i-1]; 36 | %template(vectord) vector; 37 | %template(vectors) vector; 38 | }; 39 | %include "../header/constant.h" 40 | %include "../header/properties.h" 41 | %include "../header/integrators.h" 42 | %include "../header/titan_simulation.h" 43 | %include "../preproc/preproc.h" 44 | %include "../vectordatapreproc/vectordatpreproc.h" 45 | %include "../header/stats.hpp" 46 | 47 | -------------------------------------------------------------------------------- /src/main/delete_tab.C: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: delete_tab.C 2 2003-08-13 19:26:11Z sorokine $ 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | # include 20 | #endif 21 | 22 | #include "../header/hpfem.h" 23 | /* 24 | void Delete_Table(ElementsHashTable* HT_Elem_Ptr, HashTable* HT_Node_Ptr) 25 | { 26 | 27 | int i, j, k; 28 | HashEntryPtr entryp; 29 | 30 | int elements = HT_Elem_Ptr->get_no_of_buckets(); 31 | int nodes = HT_Node_Ptr->get_no_of_buckets(); 32 | for(i = 0; i < elements; i++) 33 | { 34 | entryp = *(HT_Elem_Ptr->getbucketptr() + i); 35 | while (entryp) 36 | { 37 | Element* EmTemp = (Element*) (entryp->value); 38 | delete EmTemp; 39 | entryp = entryp->next; 40 | } 41 | } 42 | 43 | for(i = 0; i < nodes; i++) 44 | { 45 | entryp = *(HT_Node_Ptr->getbucketptr() + i); 46 | while (entryp) 47 | { 48 | Node* NdTemp = (Node*) (entryp->value); 49 | delete NdTemp; 50 | entryp = entryp->next; 51 | } 52 | } 53 | 54 | delete HT_Elem_Ptr; 55 | delete HT_Node_Ptr; 56 | 57 | } 58 | */ -------------------------------------------------------------------------------- /src/main/titanvars.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #******************************************************************* 3 | #* Copyright (C) 2003-2015 University at Buffalo 4 | #* 5 | #* This software can be redistributed free of charge. See COPYING 6 | #* file in the top distribution directory for more details. 7 | #* 8 | #* This software is distributed in the hope that it will be useful, 9 | #* but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | #* 12 | #* Description: enviroment setter 13 | #* 14 | #******************************************************************* 15 | #* 16 | TITAN2D_HOME="$(readlink -f ${BASH_SOURCE})" 17 | TITAN2D_HOME=$(dirname "$TITAN2D_HOME") 18 | export TITAN2D_HOME=$(dirname "$TITAN2D_HOME") 19 | export PATH=$TITAN2D_HOME/bin:$PATH 20 | 21 | -------------------------------------------------------------------------------- /src/preproc/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for preproc/ directory 3 | # 4 | # $Id: Makefile.am 12 2003-11-07 17:58:49Z kdalbey $ 5 | # 6 | 7 | bin_PROGRAMS = titan_materialnames 8 | #titan_preprocess 9 | 10 | titan_materialnames_SOURCES = materialnames.C 11 | 12 | titan_materialnames_CXXFLAGS = -I$(srcdir)/../gisapi -I$(srcdir)/../useful 13 | 14 | titan_materialnames_LDADD = ../gisapi/libgisapi.a ../useful/libuseful.a 15 | 16 | noinst_LIBRARIES = libtitan_preprocess.a 17 | 18 | libtitan_preprocess_a_SOURCES = = preprocess.C boundary_preproc.C createfunky.C element_preproc.C \ 19 | hilbert.C node_preproc.C \ 20 | boundary_preproc.h element_preproc.h node_preproc.h \ 21 | ../header/FileFormat.h 22 | 23 | libtitan_preprocess_a_CXXFLAGS = -I$(srcdir)/../gisapi -I$(srcdir)/../useful 24 | 25 | #titan_preprocess_LDADD = ../gisapi/libgisapi.a ../useful/libuseful.a 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/preproc/boundary_preproc.C: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: boundary.C 206 2009-01-26 17:32:10Z dkumar $ 16 | */ 17 | 18 | #ifdef HAVE_CONFIG_H 19 | # include 20 | #endif 21 | 22 | #include 23 | #include 24 | using namespace std; 25 | 26 | #include 27 | #include "boundary_preproc.h" 28 | #include "useful_lib.h" 29 | #include "../header/FileFormat.h" 30 | 31 | BoundaryPreproc::BoundaryPreproc() 32 | { 33 | } 34 | 35 | void BoundaryPreproc::setparameters(NodePreproc* n, double xv, double yv, int t) 36 | { 37 | 38 | node = n; 39 | x_value = xv; 40 | y_value = yv; 41 | type = t; 42 | 43 | } 44 | 45 | void BoundaryPreproc::write_b_data_bin(FILE *fp) 46 | { 47 | fwriteI(fp, type); 48 | fwriteI(fp, node->key[0]); 49 | fwriteI(fp, node->key[1]); 50 | #ifdef WRITEDOUBLEASFLOAT 51 | fwriteF(fp,x_value); 52 | fwriteF(fp,y_value); 53 | #else 54 | fwriteD(fp, x_value); 55 | fwriteD(fp, y_value); 56 | #endif 57 | return; 58 | } 59 | 60 | void BoundaryPreproc::write_b_data(ofstream* out) 61 | { 62 | *out << type << ' ' << node->key[0] << ' ' << node->key[1] << ' ' << x_value << ' ' << y_value << ' ' << '\n'; 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/preproc/boundary_preproc.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: boundary.h 12 2003-11-07 17:58:49Z kdalbey $ 16 | */ 17 | 18 | #ifndef BOUNDARY_PREPROC_H 19 | #define BOUNDARY_PREPROC_H 20 | #include "node_preproc.h" 21 | 22 | class BoundaryPreproc 23 | { 24 | 25 | friend class ElementPreproc; 26 | 27 | public: 28 | 29 | BoundaryPreproc(); 30 | void setparameters(NodePreproc*, double, double, int); 31 | NodePreproc* get_boundary_node() 32 | { 33 | return node; 34 | } 35 | ; 36 | int get_type() 37 | { 38 | return type; 39 | } 40 | ; 41 | double get_x_value() 42 | { 43 | return x_value; 44 | } 45 | ; 46 | double get_y_value() 47 | { 48 | return y_value; 49 | } 50 | ; 51 | void write_b_data(ofstream*); 52 | void write_b_data_bin(FILE *); 53 | 54 | private: 55 | NodePreproc* node; 56 | int type; //-2 essential -3 natural 57 | double x_value; 58 | double y_value; 59 | 60 | }; 61 | #endif 62 | -------------------------------------------------------------------------------- /src/preproc/node_preproc.h: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2003 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Author: 12 | * Description: 13 | * 14 | ******************************************************************* 15 | * $Id: node.h 12 2003-11-07 17:58:49Z kdalbey $ 16 | */ 17 | 18 | // node.h for the definition of node class 19 | #ifndef NODE_PREPROC_H 20 | #define NODE_PREPROC_H 21 | 22 | class NodePreproc 23 | { 24 | 25 | friend class ElementPreproc; 26 | //friend class Edge; 27 | friend class BoundaryPreproc; 28 | friend void get_key(double*, unsigned*, unsigned*); 29 | 30 | public: 31 | 32 | NodePreproc(int, double*, int, int); //constructor 33 | NodePreproc(); 34 | void setparameters(int, double*); 35 | int get_nodeid() 36 | { 37 | return nodeid; 38 | } 39 | ; 40 | double* get_node_coord() 41 | { 42 | return node_coord; 43 | } 44 | ; 45 | double* get_coord() 46 | { 47 | return node_coord; 48 | } 49 | ; 50 | void determine_the_key(unsigned, double*, double*, unsigned*, unsigned*); 51 | void determine_max_min(double*, double*); 52 | int get_written_flag() 53 | { 54 | return written; 55 | } 56 | ; 57 | void set_written_flag() 58 | { 59 | written = 1; 60 | } 61 | ; 62 | unsigned* get_key() 63 | { 64 | return key; 65 | } 66 | ; 67 | void write_node_data(ofstream*); 68 | void write_node_data_bin(FILE *); 69 | void clear_written_flag(); 70 | void put_element_array_loc(int); 71 | int get_element_array_loc(int); 72 | 73 | private: 74 | int nodeid; 75 | double node_coord[3]; 76 | unsigned key[2]; 77 | int written; 78 | int element_array_loc[2]; // used to find the elements faster 79 | 80 | }; 81 | #endif 82 | -------------------------------------------------------------------------------- /src/repartition/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for src/repartition directory 3 | # 4 | # $Id: Makefile.am 2 2003-08-13 19:26:11Z sorokine $ 5 | # 6 | 7 | noinst_LIBRARIES = librepartition.a 8 | 9 | librepartition_a_SOURCES = BSFC_combine_elements.C BSFC_create_bins.C \ 10 | new_datatype.C BSFC_refine_partition.C repartition_BSFC.C \ 11 | BSFC_update_and_send_elements.C repartition_BSFC.h \ 12 | BSFC_update_element_proc.C update_element_info.C fill.C 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/stochastic/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for src/adapt directory 3 | # 4 | # $Id: Makefile.am,v 1.1.1.1 2003/08/13 19:26:11 sorokine Exp $ 5 | # 6 | 7 | #bin_PROGRAMS = lhsbed lhsvol lhstitanstats gentitanteststats 8 | 9 | #lhsbed_SOURCES = lhsbed.C lhslib.C lhslib.h 10 | 11 | #lhsvol_SOURCES = lhsvol.C lhslib.C lhslib.h 12 | 13 | #lhstitanstats_SOURCES = lhstitanstats.C lhslib.C lhslib.h 14 | 15 | #gentitanteststats_SOURCES = gentitanteststats.C lhslib.C lhslib.h 16 | 17 | #lhsbed_LDADD = ../useful/libuseful.a 18 | 19 | #lhsvol_LDADD = ../useful/libuseful.a 20 | 21 | #lhstitanstats_LDADD = ../useful/libuseful.a 22 | 23 | #gentitanteststats_LDADD = ../useful/libuseful.a 24 | 25 | #EXTRA_DIST = pbslhs dist-stats.pl plot_stats.pl lhs.readme 26 | -------------------------------------------------------------------------------- /src/stochastic/gentitanteststats.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "lhslib.h" 4 | 5 | int main() 6 | { 7 | printf("This program generates the latin hypercube sampling (lhs) sample output from Titan2D.\n"); 8 | 9 | int Nstart; 10 | printf("Enter the number of initial divisions: "); 11 | scanf("%d", &Nstart); 12 | 13 | int Nref; 14 | printf("Enter the number of refinements (subdividing each interval into 2): "); 15 | scanf("%d", &Nref); 16 | 17 | int *refnum, isample, Nsample; 18 | double *samples, doubleswap; 19 | 20 | Nsample = normallhs(Nstart, Nref, &refnum, &samples); 21 | 22 | FILE *fp; 23 | char filename[128]; 24 | double time, Vave, hmax, xcen, ycen, xspread, yspread; 25 | for(isample = 0; isample < Nsample; isample++) 26 | { 27 | sprintf(filename, "statout_lhs.%02d", refnum[isample]); 28 | fp = fopen(filename, "a"); 29 | 30 | time = 30.0 + 15.0 * samples[isample]; 31 | if(time > 60.0 || time < 0.0) 32 | time = -1.0; 33 | Vave = 15.0 + 2.0 * samples[isample]; 34 | if(Vave < 0.0) 35 | Vave = 0.0; 36 | hmax = 10.0 + 1.0 * samples[isample]; 37 | if(hmax < 0.0) 38 | hmax = 0.0; 39 | xcen = 5.5e5 + 250.0 * samples[isample]; 40 | ycen = 1.25e6 + 300.0 * samples[isample]; 41 | xspread = 600 + 100 * samples[isample]; 42 | if(xspread < 10.0) 43 | xspread = 10.0; 44 | yspread = 700 + 100 * samples[isample]; 45 | if(yspread < 15.0) 46 | yspread = 15.0; 47 | 48 | fprintf(fp, "%2d %6d %12.6g %12.6g %12.6g %12.6g %12.6g %12.6g %12.6g\n", refnum[isample], isample, time, Vave, 49 | hmax, xcen, ycen, xspread, yspread); 50 | 51 | fclose(fp); 52 | } 53 | 54 | CDeAllocI1(refnum); 55 | CDeAllocD1(samples); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /src/stochastic/lhsbed.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "lhslib.h" 4 | 5 | int main() 6 | { 7 | printf("This program generates the latin hypercube sampling (lhs) sample points for the bed friction angle for a single material to be used in Titan2D.\n"); 8 | 9 | int distributiontype; 10 | printf("Please choose between a\n1) uniform distribution\n2) normal (gaussian) distribution\nenter 1 or 2: "); 11 | scanf("%d", &distributiontype); 12 | 13 | int Nstart; 14 | printf("Enter the number of initial divisions: "); 15 | scanf("%d", &Nstart); 16 | 17 | int Nref; 18 | printf("Enter the number of refinements (subdividing each interval into 2): "); 19 | scanf("%d", &Nref); 20 | 21 | int *refnum, isample, Nsample; 22 | double *samples, doubleswap; 23 | switch (distributiontype) 24 | { 25 | case 1: //uniform 26 | Nsample = uniformlhs(Nstart, Nref, &refnum, &samples); 27 | double minbed, maxbed; 28 | printf("Enter the min and max bed friction angles in degrees: "); 29 | scanf("%lf%lf", &minbed, &maxbed); 30 | if(minbed > maxbed) 31 | { 32 | doubleswap = maxbed; 33 | maxbed = minbed; 34 | minbed = doubleswap; 35 | } 36 | doubleswap = maxbed - minbed; 37 | for(isample = 0; isample < Nsample; isample++) 38 | samples[isample] = minbed + doubleswap * samples[isample]; 39 | break; 40 | case 2: 41 | Nsample = normallhs(Nstart, Nref, &refnum, &samples); 42 | double meanbed, stddevbed; 43 | printf("Enter the mean bed friction angle in degrees: "); 44 | scanf("%lf", &meanbed); 45 | 46 | printf("Enter the standard deviation of the bed friction angle in degrees: "); 47 | scanf("%lf", &stddevbed); 48 | for(isample = 0; isample < Nsample; isample++) 49 | samples[isample] = meanbed + stddevbed * samples[isample]; 50 | break; 51 | default: 52 | printf("lhsbed.C does not recognize distribution type %d\nAborting!!!", distributiontype); 53 | exit(1); 54 | break; 55 | } 56 | 57 | double A; 58 | printf("Enter the number of degrees \"A\" by which the internal friction angle exceeds the bed friction angle\nintfrict = bedfrict + A\n"); 59 | scanf("%lf", &A); 60 | 61 | FILE *fp = fopen("stat_ctl.bed", "w"); 62 | for(isample = 0; isample < Nsample; isample++) 63 | fprintf(fp, "%4d %6d %12.6g %12.6g\n", refnum[isample], isample, samples[isample], samples[isample] + A); 64 | fclose(fp); 65 | 66 | CDeAllocI1(refnum); 67 | CDeAllocD1(samples); 68 | 69 | return 0; 70 | } 71 | -------------------------------------------------------------------------------- /src/stochastic/lhslib.h: -------------------------------------------------------------------------------- 1 | #include "../useful/useful_lib.h" 2 | 3 | int uniformlhs(int Nstart, int Nref, int **refnum, double **samples); 4 | int normallhs(int Nstart, int Nref, int **refnum, double **samples); 5 | 6 | -------------------------------------------------------------------------------- /src/stochastic/lhsvol.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "lhslib.h" 4 | 5 | int main() 6 | { 7 | printf("This program generates the latin hypercube sampling (lhs) sample points for the VOLUME SCALE FACTOR for Titan2D. The resultant volume for a particular run is the product of the scale factor and the base volume entered through the Titan2D python gui\n\n"); 8 | 9 | printf("The volume scale factor will be uniformly distributed\n"); 10 | 11 | int Nstart; 12 | printf("Enter the number of initial divisions: "); 13 | scanf("%d", &Nstart); 14 | 15 | int Nref; 16 | printf("Enter the number of refinements (subdividing each interval into 2): "); 17 | scanf("%d", &Nref); 18 | 19 | int *refnum, isample, Nsample; 20 | double *samples, doubleswap; 21 | 22 | Nsample = uniformlhs(Nstart, Nref, &refnum, &samples); 23 | double minvol, maxvol; 24 | printf("Enter the min and max volume scale factor: "); 25 | scanf("%lf%lf", &minvol, &maxvol); 26 | if(minvol > maxvol) 27 | { 28 | doubleswap = maxvol; 29 | maxvol = minvol; 30 | minvol = doubleswap; 31 | } 32 | doubleswap = maxvol - minvol; 33 | for(isample = 0; isample < Nsample; isample++) 34 | samples[isample] = minvol + doubleswap * samples[isample]; 35 | 36 | FILE *fp = fopen("stat_ctl.vol", "w"); 37 | for(isample = 0; isample < Nsample; isample++) 38 | fprintf(fp, "%4d %6d %14.8g\n", refnum[isample], isample, samples[isample]); 39 | fclose(fp); 40 | 41 | CDeAllocI1(refnum); 42 | CDeAllocD1(samples); 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /src/stochastic/pbslhs: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | #PBS -l nodes=2:ppn=2 3 | #PBS -l walltime=0:59:00 4 | #PBS -M your@email.address.here 5 | #PBS -m e 6 | #PBS -j oe 7 | #PBS -o pbslhs.out 8 | # 9 | cd $PBS_O_WORKDIR 10 | perl dist-stats.pl --ctlfile stat_ctl.bed 11 | -------------------------------------------------------------------------------- /src/tecplot/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for src/tecplot directory 3 | # 4 | # $Id: Makefile.am 233 2012-03-27 18:30:40Z dkumar $ 5 | # 6 | 7 | noinst_LIBRARIES = libtecplot.a 8 | 9 | libtecplot_a_SOURCES = outsum.C tecplot.C grassout.C xdfm_write.C hd5calls.C 10 | 11 | libtecplot_a_CPPFLAGS=-I$(srcdir)/../header/ -I$(srcdir)/../gisapi 12 | 13 | -------------------------------------------------------------------------------- /src/tests/tivector_test.C: -------------------------------------------------------------------------------- 1 | /* 2 | * File: tivector_test.C 3 | * Author: mikola 4 | * 5 | * Created on August 30, 2015, 7:50 PM 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | using namespace std; 13 | 14 | #include "../header/tivector.h" 15 | 16 | /* 17 | * 18 | */ 19 | int main(int argc, char** argv) { 20 | 21 | cout<<"tivector test\n"; 22 | tivector v; 23 | cout<<"resize and init\n"; 24 | v.resize(10); 25 | for(int i=0;i0: 43 | print "\tConnections are different!" 44 | else: 45 | print "\tConnections are identical" 46 | 47 | #compare Properties 48 | for prop in ('PILE_HEIGHT', 'XMOMENTUM', 'YMOMENTUM'): 49 | print "Comparing Properties/"+prop 50 | 51 | ds1=numpy.array(f1['Properties'][prop]) 52 | ds2=numpy.array(f2['Properties'][prop]) 53 | if ds1.shape!=ds2.shape: 54 | print "\tDatasets have different size!" 55 | continue 56 | ds=(ds1-ds2)*(ds1-ds2) 57 | rmsd=math.sqrt(ds.mean()) 58 | print "\tRMSD=%.3e Mean1=%.3e RMSD/Mean1=%.3e"%(rmsd,ds1.mean(),rmsd/ds1.mean()) 59 | 60 | 61 | 62 | f2.close() 63 | f1.close() -------------------------------------------------------------------------------- /src/useful/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for pre/ directory 3 | # 4 | # $Id: Makefile.am 16 2003-11-21 16:28:06Z kdalbey $ 5 | # 6 | 7 | noinst_LIBRARIES = libuseful.a 8 | 9 | libuseful_a_SOURCES = useful_lib.C useful_lib.h 10 | -------------------------------------------------------------------------------- /src/vectordatapreproc/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for src/main/ directory 3 | # 4 | 5 | noinst_LIBRARIES = libvectordatpreproc.a 6 | 7 | libvectordatpreproc_a_SOURCES = vectordatpreproc.cpp cgis_trigrid.cpp cgis_trigrid.h cgis_vectordata.cpp cgis_vectordata.h cpolyline.cpp cpolyline.h 8 | 9 | libvectordatpreproc_CXXFLAGS = -I$(srcdir)/../gisapi/ 10 | 11 | -------------------------------------------------------------------------------- /src/vectordatapreproc/cgis_trigrid.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | cgis_trigrid.h - description 3 | ------------------- 4 | begin : Mon Feb 21 2005 5 | copyright : (C) 2005 by Amrita Chanda 6 | email : achanda@buffalo.edu 7 | ***************************************************************************/ 8 | 9 | /*************************************************************************** 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | ***************************************************************************/ 17 | 18 | #ifndef CGIS_TRIGRID_H 19 | #define CGIS_TRIGRID_H 20 | 21 | /**This class creates an array of elevations. 22 | It answers the queries: Which triangle(s) contain point (x,y)? 23 | and which triangles fall within the bounding area (x1,y1) and (x2,y2)? 24 | *@author Amrita Chanda 25 | */ 26 | 27 | class CGIS_TriGrid 28 | { 29 | public: 30 | CGIS_TriGrid(char *GIS_Dbase, char *GIS_Maplocation, char *GIS_Mapset, char *GIS_Rasterimage); 31 | ~CGIS_TriGrid(); 32 | 33 | double *_elevations; 34 | double _xmax, _xmin, _ymax, _ymin; 35 | int _num_of_rows; 36 | int _num_of_cols; 37 | double _res; 38 | 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/vectordatapreproc/cgis_vectordata.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | cgis_vectordata.h - description 3 | ------------------- 4 | begin : Mon Feb 21 2005 5 | copyright : (C) 2005 by Amrita Chanda 6 | email : achanda@buffalo.edu 7 | ***************************************************************************/ 8 | 9 | /*************************************************************************** 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | ***************************************************************************/ 17 | 18 | #ifndef CGIS_VECTORDATA_H 19 | #define CGIS_VECTORDATA_H 20 | 21 | #include 22 | #include 23 | using namespace std; 24 | 25 | #include "cpolyline.h" 26 | 27 | /**This class holds a vector of PolyLine objects. 28 | *@author Amrita Chanda 29 | */ 30 | 31 | class CGIS_VectorData 32 | { 33 | public: 34 | CGIS_VectorData(); 35 | CGIS_VectorData(double res, double xmin, double xmax, double ymin, double ymax, int rows, int cols, 36 | const char *GIS_Dbase, const char *GIS_Maplocation, const char *GIS_Mapset, 37 | const char *GIS_VectorFile); 38 | ~CGIS_VectorData(); 39 | 40 | int ReadVectorData(); 41 | 42 | int ProjectOn2DGrid(); 43 | 44 | int StoreInFile(); 45 | 46 | int ReadFromFile(); 47 | 48 | private: 49 | vector _polylines; 50 | double _res, _xmin, _xmax, _ymin, _ymax; 51 | int _npolylines, _rows, _cols; 52 | char _gisDBase[256], _gisMaplocation[256], _gisMapset[256], _gisVectorFile[256]; 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/vectordatapreproc/cpolyline.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | cpolyline.h - description 3 | ------------------- 4 | begin : Mon Feb 21 2005 5 | copyright : (C) 2005 by Amrita Chanda 6 | email : achanda@buffalo.edu 7 | ***************************************************************************/ 8 | 9 | /*************************************************************************** 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | ***************************************************************************/ 17 | 18 | #ifndef CPOLYLINE_H 19 | #define CPOLYLINE_H 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | using namespace std; 27 | 28 | /**This class represents a line made up of many segments. It hold a list of xy points on the line. 29 | *@author Amrita Chanda 30 | */ 31 | 32 | class CPolyLine 33 | { 34 | public: 35 | CPolyLine(int type, string lbl); 36 | CPolyLine(); 37 | ~CPolyLine(); 38 | 39 | void SetLinesXY(int npts, double *x, double *y); 40 | 41 | int Get_ith_xy(int idx, float *x, float *y); 42 | 43 | int WritePolyLine(ofstream *stream); 44 | 45 | int ReadPolyLine(ifstream *stream); 46 | 47 | int _numOfPts; 48 | int _type; 49 | float **_xylst; 50 | string _label; 51 | 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/vectordatapreproc/vectordatpreproc.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | main.cpp - description 3 | ------------------- 4 | begin : Mon Feb 21 17:41:53 EST 2005 5 | copyright : (C) |YEAR| by Amrita Chanda 6 | email : achanda@buffalo.edu 7 | ***************************************************************************/ 8 | 9 | /*************************************************************************** 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | ***************************************************************************/ 17 | 18 | #ifndef VECTORDATPREPROC_H 19 | #define VECTORDATPREPROC_H 20 | 21 | int vectordatpreproc(const char * topomain, const char * toposub, const char * topomapset, const char * topomap, 22 | const char * topovector); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for test/ directory 3 | # 4 | # 5 | 6 | SUBDIRS = ticore 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/ticore/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # automake template for src/main directory 3 | # 4 | # $Id: Makefile.am 134 2007-06-07 20:05:52Z dkumar $ 5 | # 6 | 7 | noinst_PROGRAMS = ticore_test 8 | 9 | ticore_test_SOURCES = ticore_test.cpp 10 | 11 | -------------------------------------------------------------------------------- /tests/ticore/ticore_test.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2015 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Description: ticore test 12 | * 13 | ******************************************************************* 14 | */ 15 | 16 | #ifdef HAVE_CONFIG_H 17 | # include 18 | #endif 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | using namespace std; 25 | 26 | #ifdef _OPENMP 27 | #include 28 | #endif 29 | 30 | #include "../titest_common.hpp" 31 | 32 | #include "../../src/header/tivector.h" 33 | 34 | #include "ticore_tisearch.hpp" 35 | #include "ticore_tisort.hpp" 36 | 37 | int threads_number; 38 | int verbose; 39 | int main(int argc, char *argv[]) 40 | { 41 | process_cmdline(argc,argv); 42 | 43 | cout<<"tocore test\n"; 44 | 45 | tisearch_test(); 46 | tisort_test(); 47 | 48 | cout<<"test passed\n"; 49 | return 0; 50 | } 51 | 52 | 53 | -------------------------------------------------------------------------------- /tests/ticore/ticore_tisearch.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2015 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Description: ticore test 12 | * 13 | ******************************************************************* 14 | */ 15 | 16 | #ifndef TESTS_TICORE_TICORE_TISEARCH_HPP_ 17 | #define TESTS_TICORE_TICORE_TISEARCH_HPP_ 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | using namespace std; 24 | 25 | #ifdef _OPENMP 26 | #include 27 | #endif 28 | 29 | #include "../../src/header/sfc.h" 30 | #include "../../src/header/ticore/tisearch.hpp" 31 | 32 | 33 | inline void tisearch_test() 34 | { 35 | cout<<"tisearch_test ...\n"; 36 | { 37 | //some where in the middle 38 | vector vec={0,1,2,3,5,6,7}; 39 | SFC_Key f=4; 40 | assert(find_insertion_spot(vec.size(),&(vec[0]),f)==4); 41 | } 42 | { 43 | //all the way to the left 44 | vector vec={1,2,3,5,6,7}; 45 | SFC_Key f=0; 46 | assert(find_insertion_spot(vec.size(),&(vec[0]),f)==0); 47 | } 48 | { 49 | //all the way to the right 50 | vector vec={1,2,3,5,6,7}; 51 | SFC_Key f=8; 52 | assert(find_insertion_spot(vec.size(),&(vec[0]),f)==6); 53 | } 54 | cout<<"tisearch_test passed\n"; 55 | } 56 | 57 | 58 | #endif /* TESTS_TICORE_TICORE_TISEARCH_HPP_ */ 59 | -------------------------------------------------------------------------------- /tests/titest_common.hpp: -------------------------------------------------------------------------------- 1 | /******************************************************************* 2 | * Copyright (C) 2015 University at Buffalo 3 | * 4 | * This software can be redistributed free of charge. See COPYING 5 | * file in the top distribution directory for more details. 6 | * 7 | * This software is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 10 | * 11 | * Description: common routines for tests 12 | * 13 | ******************************************************************* 14 | */ 15 | 16 | #ifndef TESTS_TITEST_COMMON_HPP_ 17 | #define TESTS_TITEST_COMMON_HPP_ 18 | 19 | #ifdef _OPENMP 20 | #include 21 | #endif 22 | 23 | 24 | extern int threads_number; 25 | extern int verbose; 26 | 27 | void process_cmdline(int argc, char *argv[]) 28 | { 29 | int num_threads = 1; 30 | verbose=0; 31 | if(argc > 1) 32 | { 33 | for(int i = 0; i < argc; i++) 34 | { 35 | string arg(argv[i]); 36 | //strip off arguments which should not make to python 37 | if(arg == "-nt") 38 | { 39 | 40 | if((i + 1 >= argc) || (!isdigit(argv[i + 1][0]))) 41 | { 42 | printf("Error: Incorrect command line format\n"); 43 | break; 44 | } 45 | ++i; 46 | 47 | num_threads = atoi(argv[i]); 48 | 49 | //set openmp threads 50 | #ifndef _OPENMP 51 | if(num_threads > 1) 52 | printf("Warning: This version was compiled without openmp support!\n"); 53 | 54 | num_threads = 1; 55 | printf("Set threads number to %d\n\n", num_threads); 56 | #endif 57 | continue; 58 | } 59 | if(arg == "-v") 60 | { 61 | verbose=1; 62 | } 63 | } 64 | } 65 | 66 | #ifdef _OPENMP 67 | omp_set_num_threads(num_threads); 68 | threads_number=omp_get_max_threads(); 69 | #else 70 | threads_number = 1; 71 | #endif 72 | printf("Max threads number is %d\n\n", threads_number); 73 | } 74 | 75 | 76 | 77 | #endif /* TESTS_TITEST_COMMON_HPP_ */ 78 | --------------------------------------------------------------------------------