Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code according to microsoft style #36

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions src/consgeo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,46 @@
#include <iostream>
#include <string>

#include <plog/Init.h>
#include <plog/Formatters/TxtFormatter.h>
#include <plog/Appenders/ColorConsoleAppender.h>
#include <plog/Formatters/TxtFormatter.h>
#include <plog/Init.h>

#include <argparse/argparse.hpp>

#include "g4ox.h"

using namespace std;


int main(int argc, char **argv)
{
using PLogFormat = plog::TxtFormatter;
static plog::ColorConsoleAppender<PLogFormat> consoleAppender;
plog::init(plog::debug, &consoleAppender);
using PLogFormat = plog::TxtFormatter;
static plog::ColorConsoleAppender<PLogFormat> consoleAppender;
plog::init(plog::debug, &consoleAppender);

argparse::ArgumentParser program("consgeo", "0.0.0");
argparse::ArgumentParser program("consgeo", "0.0.0");

string gdml_file;
string gdml_file;

program.add_argument("-g", "--gdml")
.help("path to GDML file")
.default_value(string("geom.gdml"))
.nargs(1)
.store_into(gdml_file);
program.add_argument("-g", "--gdml")
.help("path to GDML file")
.default_value(string("geom.gdml"))
.nargs(1)
.store_into(gdml_file);

try {
program.parse_args(argc, argv);
}
catch (const exception& err) {
cerr << err.what() << endl;
cerr << program;
exit(EXIT_FAILURE);
}
try
{
program.parse_args(argc, argv);
}
catch (const exception &err)
{
cerr << err.what() << endl;
cerr << program;
exit(EXIT_FAILURE);
}

cout << "gdml_file: " << gdml_file << endl;
cout << "gdml_file: " << gdml_file << endl;

from_gdml(gdml_file);
from_gdml(gdml_file);

return EXIT_SUCCESS;
return EXIT_SUCCESS;
}
27 changes: 14 additions & 13 deletions src/csg_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,24 @@

using namespace std;


void from_gdml(filesystem::path gdmlpath)
{
G4GDMLParser parser;
parser.Read(gdmlpath.string(), false);
G4GDMLParser parser;
parser.Read(gdmlpath.string(), false);

const G4VPhysicalVolume* world = parser.GetWorldVolume();
const G4VPhysicalVolume *world = parser.GetWorldVolume();

if (!world) {
LOG_ERROR << "Failed creatng G4 volume from GDML " << gdmlpath << endl;
}
else {
LOG_INFO << "Created G4 volume " << world->GetName() << " from " << gdmlpath << endl;
if (!world)
{
LOG_ERROR << "Failed creatng G4 volume from GDML " << gdmlpath << endl;
}
else
{
LOG_INFO << "Created G4 volume " << world->GetName() << " from " << gdmlpath << endl;

G4CXOpticks* g4cx = G4CXOpticks::SetGeometry(world);
g4cx->saveGeometry("./out/csg");
G4CXOpticks *g4cx = G4CXOpticks::SetGeometry(world);
g4cx->saveGeometry("./out/csg");

delete g4cx;
}
delete g4cx;
}
}
Loading