Skip to content

Commit

Permalink
Added srf2mrf tool to convert SRF file into MRF format.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiolsilva committed Nov 8, 2024
1 parent aab28f8 commit 4bb500e
Show file tree
Hide file tree
Showing 6 changed files with 646 additions and 38 deletions.
3 changes: 2 additions & 1 deletion bbp/src/gp/StandRupFormat/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ fault_seg2gsf
generic_slip2srf
srf2moment
srf2stoch
srf2xyz
srf2xyz
srf2mrf
3 changes: 3 additions & 0 deletions bbp/src/gp/StandRupFormat/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ void read_srf(struct standrupformat *,char *,int);
void write_srf(struct standrupformat *,char *,int);
void write_srf1(struct standrupformat *,char *,int);
void write_srf2(struct standrupformat *,char *,int);
void write_srf3(struct standrupformat *,char *,int);
void copy_hcmnt(struct standrupformat *srf2,struct standrupformat *srf1);
void load_command_srf(struct standrupformat *,int,char **);
void load_seed_srf(struct standrupformat *srf,int,int);
Expand All @@ -64,3 +65,5 @@ void zapit(float *, int);
void gcproj(float *,float *,float *,float *,float *,double *,double *,double *,double *,int);
void gen_matrices(double *,double *,float *,float *,float *);
void dump_sliprate(char *,struct standrupformat *,int,float *,float *,float *);

void srf_to_mrf(struct standrupformat *,struct standrupformat *,struct velmodel *,int,int,int,char **);
8 changes: 6 additions & 2 deletions bbp/src/gp/StandRupFormat/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ FFLAGS = ${UFLAGS} -ffixed-line-length-132

##### make options

all: srf2stoch generic_slip2srf fault_seg2gsf srf2moment srf2xyz
all: srf2stoch generic_slip2srf fault_seg2gsf srf2moment srf2xyz srf2mrf

test_header : test_header.c ${OBJS} ${GEOPROJ_OBJS}
$(CC) $(CFLAGS) -o test_header test_header.c ${LDLIBS} ${GEOPROJ_OBJS}
Expand Down Expand Up @@ -66,7 +66,11 @@ srf2xyz : srf2xyz.c ${OBJS} ${GEOPROJ_OBJS}
${CC} -o srf2xyz srf2xyz.c ${LDLIBS} ${INCPAR} ${GEOPROJ_OBJS}
cp srf2xyz ../bin/

srf2mrf : srf2mrf.c ${OBJS} ${GEOPROJ_OBJS}
${CC} -o srf2mrf srf2mrf.c ${LDLIBS} ${INCPAR} ${GEOPROJ_OBJS}
cp srf2mrf ../bin/

${OBJS} : ${HEADS}

clean :
rm -f *.o ${GENRAND_OBJS} ${BAILEY_OBJS} ${GEOPROJ_OBJS} *.o srf2xyz fault_seg2gsf srf2moment generic_slip2srf srf2stoch test_header
rm -f *.o ${GENRAND_OBJS} ${BAILEY_OBJS} ${GEOPROJ_OBJS} *.o srf2xyz fault_seg2gsf srf2moment generic_slip2srf srf2stoch test_header srf2mrf
38 changes: 38 additions & 0 deletions bbp/src/gp/StandRupFormat/srf2mrf.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include "include.h"
#include "structure.h"
#include "function.h"
#include "defs.h"
#include "getpar.h"

int main(int ac,char **av)
{
char infile[1024], outfile[1024];
struct standrupformat srf, mrf;
char velfile[1024];
struct velmodel vmod;

int inbin = 0;
int outbin = 0;

int use_srf_lame = 0;
int print_command = 1;

sprintf(infile,"stdin");
sprintf(outfile,"stdout");
sprintf(velfile,"NOT_PROVIDED");

setpar(ac,av);
getpar("infile","s",infile);
getpar("outfile","s",outfile);
getpar("velfile","s",velfile);
getpar("use_srf_lame","d",&use_srf_lame);
getpar("print_command","d",&print_command);
endpar();

read_Fvelmodel(velfile,&vmod);
read_srf(&srf,infile,inbin);

srf_to_mrf(&srf,&mrf,&vmod,use_srf_lame,print_command,ac,av);

write_srf(&mrf,outfile,outbin);
}
Loading

0 comments on commit 4bb500e

Please sign in to comment.