Skip to content

Commit 55a8a1d

Browse files
committed
Changes to make it work, its working! Huzzah!
1 parent 62c61b0 commit 55a8a1d

2 files changed

Lines changed: 43 additions & 2 deletions

File tree

src/fluka/app/mainFluDAG.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "dagmcmetadata.hpp"
1414
#include "moab/ProgOptions.hpp"
1515

16+
#include <cstdlib>
1617
#include <cstring>
1718
#include <fstream>
1819
#include <time.h> // for timing the routine
@@ -116,8 +117,30 @@ int main(int argc, char* argv[]) {
116117
fludag_write_ididx(vol_id);
117118
} else {
118119
// call fluka run
119-
// flugg mode is flag = 1
120-
const int flag = 1;
120+
121+
// check for the input file argument
122+
// get it from the command line
123+
if(argc >= 1) {
124+
// convert to std::string
125+
std::string chinpf_s(argv[1]);
126+
char chinpf[256] = "";
127+
memset(chinpf,' ',256);
128+
std::copy(chinpf_s.begin(),chinpf_s.end(),chinpf);
129+
strcpy(chcmpt_.chinpf,chinpf);
130+
} else {
131+
// get it from the environment
132+
std::cout << "from env" << std::endl;
133+
char* env = std::getenv("INPF");
134+
std::cout << env << std::endl;
135+
strncpy(env,chcmpt_.chinpf,sizeof(env));
136+
if (chcmpt_.chinpf[0] == 0) {
137+
// flabrt("FLUKAM","FLUDAG NO INPUT SPECIFIED");
138+
return 1;
139+
}
140+
std::cout << chcmpt_.chinpf << std::endl;
141+
}
142+
const int flag = 2;
143+
std::cout << "running fluka" << std::endl;
121144
flukam(flag);
122145
}
123146

src/fluka/fluka_funcs.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,24 @@ extern "C" {
132132
} mulbou_;
133133
}
134134

135+
// the CHCMPT struct for
136+
// setting the input name
137+
extern "C" {
138+
extern struct {
139+
char comptr[50];
140+
char inpfil[200];
141+
char pwddir[200];
142+
char hlfdir[200];
143+
char homdir[200];
144+
char hostnm[200];
145+
char usrflk[200];
146+
char grpflk[200];
147+
char inpnam[200];
148+
char chinpf[256];
149+
char hfpath[200];
150+
} chcmpt_;
151+
}
152+
135153
// struct to hold particle state
136154
struct particle_state {
137155
moab::DagMC::RayHistory history;

0 commit comments

Comments
 (0)