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

Build MCNP Shared Library #33

Closed
wants to merge 10 commits into from
Closed

Conversation

ejwilson3
Copy link
Collaborator

This pull request is focused on the functionality of the code to turn MCNP2CAD into a library able to be called by a Trelis-Plugin. There is another pull request planned for the future with fixes to formatting and commenting issues.

@@ -54,6 +54,7 @@ static int makeint( const std::string& token ){
char* end;
int ret = strtol(str, &end, 10);
if( end != str+token.length() ){
record << "Warning: string [" << token << "] did not convert to int as expected." << std::endl;
std::cerr << "Warning: string [" << token << "] did not convert to int as expected." << std::endl;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:neckbeard: The ghost of hackers past moans:

These duplicated printouts make me sad. Consider defining

// Note: this macro will evaluate its argument expression twice!
#define NOISY_WARNING(OUTPUT_EXPR) do{ \
   std::cerr << "Warning: " << OUTPUT_EXPR << std::endl; \
   record    << "Warning: " << OUTPUT_EXPR << std::endl; \
} while (0)

Then these bug-prone output copypastas can become simply

NOISY_WARNING( "string [" << token << "] did not convert to int as expected" );

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was actually decided to remove the cerr outputs entirely; those changes will be in the next PR, but I could make another small commit to this one removing them as well.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't bother -- if you're planning to clean it up in in a future PR that's fine.

(Output and logging in c++ is always a colorful bikeshed. In the past I've written custom ostream subclasses that can optionally direct to zero, one, or multiple outputs (stdout, file, etc.), but it's a hassle to maintain. Lavtely I've found it most comfortable to create macros that accept ostream syntax. This provides a nice way to centrally control verbosity, write to multiple outputs, compile out DEBUG statements, etc.)

MCNPInput.hpp Outdated
@@ -3,12 +3,14 @@

#include <vector>
#include <map>
#include <iosfwd>
//#include <iosfwd>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these be removed entirely rather than being commented?

@gonuke
Copy link
Member

gonuke commented Apr 24, 2017

Can we move the CLI files into a subdirectory - perhaps called cli with appropriate changes to the CMakeLists.txt file?

CMakeLists.txt Outdated
endif()

# Get the packages needed to use the SDK
find_package(Cubit REQUIRED CONFIG)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this required? Do we perhaps need a more generic version of this to find some form of iGeom?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a number of header files needed by iGeom that are found in Trelis. iGeom.h needs to include RefGroup.hpp for much of the CATag parts, which in turn includes more files.
mcnp2cad also needs GeometryModifyTool.hpp (which include I had erroneously put into iGeom.h) in order to take advantage of the PRINT_INFO macro, without which we would have to find another way to print to the Trelis command line, if we want to do that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this will now be a stand-alone library that needs to know where to find iGeom and hopefully upon doing so, is told where to find the other includes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per our discussion: change Cubit to CGM and then use CGM_*_DIR throughout.

CMakeLists.txt Outdated

# These directories need to be defined by the user.
include_directories(${IGEOM_INCLUDE_DIR})
include_directories(${MOAB_INCLUDE_DIR})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need MOAB includes? I thought this depend only iGeom?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had been linking to the MOAB includes for iBase.h, since iGeom uses iBase_EntityHandles to keep track of everything. I can actually just take iBase.h from MOAB; it's only about 500 lines. I was trying to avoid copying files as much as possible, but it's probably worth it to avoid having to have MOAB installed as well if one isn't using the plugin's iGeom.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't iGeom have it's own iBase?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gonuke
Copy link
Member

gonuke commented Apr 24, 2017

We probably need to revise the README to reflect these changes.

@gonuke
Copy link
Member

gonuke commented Nov 23, 2018

Replaced by #53

@gonuke gonuke closed this Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants