Rupture Variation Generator v5.4.2 code changes
From SCECpedia
Jump to navigationJump to searchThis page documents the code changes required to turn the stand-alone version, genslip-v5.4.2, into an API callable by the CyberShake post-processing.
In this document, $ROOT_DIR is taken to be the <CyberShake home>/software/RuptureCodes/RupGen-api-5.4.2 directory. GenRandV5.0 is the code as received from Rob Graves.
Contents
Installing files
- Create src, include, lib, and bin directories inside $ROOT_DIR .
- Inside src, create GenRandV5.0.
- Copy rupgen_api.c from a previous API version into src.
- Copy rupgen_defs.h from a previous API version into src.
- Copy rupgen_api.h from a previous API version into include.
- Create a symlink in src which points to $ROOT_DIR/include/rupgen_api.h .
- Confusingly, there are two files named structure.h. One is in StandRupFormat and contains the structures needed for an SRF. The other is in GenRandV5.0 and contains the definition for complex, along with a few other supporting structures.
- Copy the StandRupFormat/structure.h into include/srf_structure.h .
- Copy the GenRandV5.0/structure.h into include/structure.h .
- Create a symlink to both files in src.
- Create a symlink to both files in src/GenRandV5.0.
- From the code provided by Rob, copy the following files into src/GenRandV5.0:
- defs.h
- function.h
- include.h
- genslip-v5.4.2.c
- iofunc.c
- misc.c
- ruptime.c
- slip.c
- srf_subs.c (from StandRupFormat)
- makefile
Editing files
In $ROOT_DIR/src
structure.h
- At the top of the file, change '#include "StandRupFormat/structure.h"' to '#include srf_structure.h'
- Above that line, add:
#ifndef STRUCT_H #define STRUCT_H
- At the end of the file, add:
#endif
srf_structure.h
- At the top of the file, add:
#ifndef SRF_STRUCT_H #define SRF_STRUCT_H
- At the end of the file, add:
#endif
In GenRandV5.0
makefile
- Edit the 2nd line that begins with OBJS so it contains
OBJS = iofunc.o misc.o slip.o ruptime.o srf_subs.o
- Delete the SRF_OBJS and FDRT_OBJS lines, 3-5.
- Edit GETPARLIB and GETPARINC so it correctly points to the Getpar install in <CyberShake home>/software/Getpar .
- Delete all targets except genslip-v5.4.2, ${OBJS}, and clean.
- Modify the genslip-v5.4.2 target. We need to remove unnecessary objects, and compile it to an object rather than an executable for inclusion in the genslip library. It should look like:
genslip-v5.4.2.o : genslip-v5.4.2.c ${OBJS} ${CC} -c -o genslip-v5.4.2.o genslip-v5.4.2.c ${LDLIBS} ${OBJS}Note that if you copy/paste the line above, make will probably give you a whitespace error. Remember to replace the whitespace in front of ${CC} with a tab.