Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModelTools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
GeoModelDev
GeoModelTools
Commits
e80c117a
Commit
e80c117a
authored
5 years ago
by
Joseph Boudreau
Browse files
Options
Downloads
Patches
Plain Diff
gmcat reposited
parent
b5cc5ca8
Branches
Branches containing commit
Tags
3.1.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GMCAT/src/gmcat.cxx
+31
-12
31 additions, 12 deletions
GMCAT/src/gmcat.cxx
with
31 additions
and
12 deletions
GMCAT/src/gmcat.cxx
+
31
−
12
View file @
e80c117a
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include
<iostream>
#include
<iostream>
#include
<string>
#include
<string>
#include
<vector>
#include
<vector>
#include
<unistd.h>
#ifdef __APPLE__
#ifdef __APPLE__
const
std
::
string
shared_obj_extension
=
".dylib"
;
const
std
::
string
shared_obj_extension
=
".dylib"
;
#else
#else
...
@@ -71,13 +72,27 @@ int main(int argc, char ** argv) {
...
@@ -71,13 +72,27 @@ int main(int argc, char ** argv) {
}
}
}
}
// if (((inputPlugins.size()+inputFiles.size())<1) || outputFile=="") {
// std::cout << usage << std::endl;
// return 3;
// }
//
//
// C
reate a huge world volume made of Air:
// C
heck that we can access the output file
//
//
if
(
access
(
outputFile
.
c_str
(),
F_OK
)
==
0
)
{
if
(
!
access
(
outputFile
.
c_str
(),
W_OK
))
{
if
(
system
((
"rm -f "
+
outputFile
).
c_str
()))
{
std
::
cerr
<<
"Error, cannot overwrite existing file "
<<
outputFile
<<
std
::
endl
;
return
3
;
}
}
else
{
std
::
cerr
<<
"Error, cannot overwrite existing file "
<<
outputFile
<<
" (permission denied)"
<<
std
::
endl
;
return
4
;
}
}
//
// Create elements and materials:
//
const
double
gr
=
SYSTEM_OF_UNITS
::
gram
;
const
double
gr
=
SYSTEM_OF_UNITS
::
gram
;
const
double
mole
=
SYSTEM_OF_UNITS
::
mole
;
const
double
mole
=
SYSTEM_OF_UNITS
::
mole
;
const
double
cm3
=
SYSTEM_OF_UNITS
::
cm3
;
const
double
cm3
=
SYSTEM_OF_UNITS
::
cm3
;
...
@@ -95,7 +110,11 @@ int main(int argc, char ** argv) {
...
@@ -95,7 +110,11 @@ int main(int argc, char ** argv) {
air
->
add
(
Argon
,
0.0129
);
air
->
add
(
Argon
,
0.0129
);
air
->
add
(
Hydrogen
,
0.0008
);
air
->
add
(
Hydrogen
,
0.0008
);
air
->
lock
();
air
->
lock
();
//
// Create a huge world volume made of Air:
//
const
GeoBox
*
worldBox
=
new
GeoBox
(
2000
*
SYSTEM_OF_UNITS
::
cm
,
2000
*
SYSTEM_OF_UNITS
::
cm
,
2000
*
SYSTEM_OF_UNITS
::
cm
);
const
GeoBox
*
worldBox
=
new
GeoBox
(
2000
*
SYSTEM_OF_UNITS
::
cm
,
2000
*
SYSTEM_OF_UNITS
::
cm
,
2000
*
SYSTEM_OF_UNITS
::
cm
);
const
GeoLogVol
*
worldLog
=
new
GeoLogVol
(
"WorldLog"
,
worldBox
,
air
);
const
GeoLogVol
*
worldLog
=
new
GeoLogVol
(
"WorldLog"
,
worldBox
,
air
);
GeoPhysVol
*
world
=
new
GeoPhysVol
(
worldLog
);
GeoPhysVol
*
world
=
new
GeoPhysVol
(
worldLog
);
...
@@ -117,7 +136,8 @@ int main(int argc, char ** argv) {
...
@@ -117,7 +136,8 @@ int main(int argc, char ** argv) {
// Loop over files, create the geometry and put it under the world:
// Loop over files, create the geometry and put it under the world:
//
//
for
(
const
std
::
string
&
file
:
inputFiles
)
{
for
(
const
std
::
string
&
file
:
inputFiles
)
{
GMDBManager
*
db
=
new
GMDBManager
(
file
.
c_str
());
QString
fString
=
file
.
c_str
();
GMDBManager
*
db
=
new
GMDBManager
(
fString
);
if
(
!
db
->
isOpen
()){
if
(
!
db
->
isOpen
()){
std
::
cerr
<<
"Error opening input file "
<<
file
<<
std
::
endl
;
std
::
cerr
<<
"Error opening input file "
<<
file
<<
std
::
endl
;
return
6
;
return
6
;
...
@@ -129,7 +149,6 @@ int main(int argc, char ** argv) {
...
@@ -129,7 +149,6 @@ int main(int argc, char ** argv) {
/* build the GeoModel geometry */
/* build the GeoModel geometry */
GeoPhysVol
*
dbPhys
=
readInGeo
.
buildGeoModel
();
// builds the whole GeoModel tree in memory
GeoPhysVol
*
dbPhys
=
readInGeo
.
buildGeoModel
();
// builds the whole GeoModel tree in memory
//world->add(dbPhys);
GeoVolumeCursor
aV
(
dbPhys
);
GeoVolumeCursor
aV
(
dbPhys
);
while
(
!
aV
.
atEnd
())
{
while
(
!
aV
.
atEnd
())
{
...
@@ -142,19 +161,19 @@ int main(int argc, char ** argv) {
...
@@ -142,19 +161,19 @@ int main(int argc, char ** argv) {
}
}
delete
db
;
delete
db
;
}
}
//
//
// Open a new database:
// Open a new database:
//
//
GMDBManager
db
(
outputFile
.
c_str
());
GMDBManager
db
(
outputFile
.
c_str
());
GeoModelIO
::
WriteGeoModel
dumpGeoModelGraph
(
db
);
//
// check the DB connection
// check the DB connection
//
if
(
!
db
.
isOpen
())
{
if
(
!
db
.
isOpen
())
{
std
::
cerr
<<
"Error opening output file "
<<
outputFile
<<
std
::
endl
;
std
::
cerr
<<
"Error opening output file "
<<
outputFile
<<
std
::
endl
;
return
4
;
return
7
;
}
}
GeoModelIO
::
WriteGeoModel
dumpGeoModelGraph
(
db
);
world
->
exec
(
&
dumpGeoModelGraph
);
world
->
exec
(
&
dumpGeoModelGraph
);
dumpGeoModelGraph
.
saveToDB
();
dumpGeoModelGraph
.
saveToDB
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment