Skip to content

Commit

Permalink
Merge pull request #175 from keadyk/compton_data_updates
Browse files Browse the repository at this point in the history
Compton data updates
  • Loading branch information
KineticTheory authored Mar 8, 2017
2 parents 2b001c6 + f06dbae commit e772977
Show file tree
Hide file tree
Showing 8 changed files with 461 additions and 344 deletions.
87 changes: 87 additions & 0 deletions config/FindCOMPTON.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#-----------------------------*-cmake-*----------------------------------------#
# file config/FindCompton.cmake
# author Kendra Keady <[email protected]>
# date 2017 February 28
# brief Instructions for discovering the Compton vendor libraries.
# note Copyright (C) 2016-2017 Los Alamos National Security, LLC.
# All rights reserved.
#------------------------------------------------------------------------------#
# - Find Compton
# Find the native Compton includes and library
#
# COMPTON_INCLUDE_DIRS - where to find multigroup_lib_builder.hh, etc.
# COMPTON_LIBRARIES - List of libraries when using Compton.
# COMPTON_FOUND - True if Compton found.

if (APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.dylib")
endif()

find_path( COMPTON_INCLUDE_DIR
NAMES
multigroup_lib_builder.hh
PATHS
${COMPTON_INC_DIR}
$ENV{COMPTON_INC_DIR}
$ENV{VENDOR_DIR}/include
${VENDOR_DIR}/include
NO_DEFAULT_PATH
)

# TODO: Win32 logic untested as of 2/28/17.
if( WIN32 )
if( COMPTON_STATIC )
set( COMPTON_LIBRARY_NAME libcompton.lib)
else()
set( COMPTON_LIBRARY_NAME libcompton_dll.lib)
endif()
else()
set( COMPTON_LIBRARY_NAME libLib_compton.a)
endif()

find_library(COMPTON_LIBRARY
NAMES ${COMPTON_LIBRARY_NAME}
PATHS
${COMPTON_LIB_DIR}
$ENV{COMPTON_LIB_DIR}
$ENV{VENDOR_DIR}/lib
${VENDOR_DIR}/lib
NO_DEFAULT_PATH
)

# If above fails, look in default locations
if( NOT COMPTON_LIBRARY )
find_path( COMPTON_INCLUDE_DIR NAMES multigroup_lib_builder.hh )
find_library(COMPTON_LIBRARY NAMES ${COMPTON_LIBRARY_NAME} )
endif()
mark_as_advanced( COMPTON_LIBRARY COMPTON_INCLUDE_DIR )

# handle the QUIETLY and REQUIRED arguments and set COMPTON_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(COMPTON DEFAULT_MSG COMPTON_INCLUDE_DIR COMPTON_LIBRARY)

if (COMPTON_FOUND)
set(COMPTON_FOUND ${COMPTON_FOUND} CACHE BOOL "Did we find the Compton libraries?")
set(COMPTON_INCLUDE_DIRS ${COMPTON_INCLUDE_DIR})
set(COMPTON_LIBRARIES ${COMPTON_LIBRARY} CACHE
FILEPATH "Compton libraries for linking." )

string( REPLACE "_dll.lib" ".dll" COMPTON_DLL ${COMPTON_LIBRARY} )
mark_as_advanced( COMPTON_DLL )
if( EXISTS ${COMPTON_DLL} )
set(COMPTON_DLL_LIBRARIES "${COMPTON_DLL}" CACHE STRING
"list of compton dll files.")
mark_as_advanced( COMPTON_DLL_LIBRARIES COMPTON_LIBRARIES )
else()
set( COMPTON_DLL "NOTFOUND")
endif()
endif()

if( VERBOSE )
message("
COMPTON_FOUND = ${COMPTON_FOUND}
COMPTON_INCLUDE_DIRS = ${COMPTON_INCLUDE_DIR}
COMPTON_LIBRARIES = ${COMPTON_LIBRARY}
")
endif()
87 changes: 0 additions & 87 deletions config/FindNWA.cmake

This file was deleted.

18 changes: 9 additions & 9 deletions src/compton/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ cmake_minimum_required(VERSION 3.0.0)
project( compton CXX )

##---------------------------------------------------------------------------##
# Requires NWA
# Requires COMPTON
##---------------------------------------------------------------------------##
find_package( NWA QUIET )
set_package_properties( NWA PROPERTIES
find_package( COMPTON QUIET )
set_package_properties( COMPTON PROPERTIES
DESCRIPTION "Access multigroup Compton scattering data."
TYPE OPTIONAL
PURPOSE "Required for bulding the compton component."
)

if( NWA_FOUND )
if( COMPTON_FOUND )
# ---------------------------------------------------------------------------- #
# Source files
# ---------------------------------------------------------------------------- #
Expand All @@ -42,7 +42,7 @@ include_directories(
${PROJECT_SOURCE_DIR}/.. # ds++ and compton header files
${dsxx_BINARY_DIR} # ds++/config.h
${ode_BINARY_DIR} # ode/config.h
${NWA_INCLUDE_DIR}
${COMPTON_INCLUDE_DIR}
)

# ---------------------------------------------------------------------------- #
Expand All @@ -54,9 +54,9 @@ add_component_library(
TARGET_DEPS Lib_dsxx
LIBRARY_NAME compton
SOURCES "${sources}"
VENDOR_LIST "NWA"
VENDOR_LIBS "${NWA_LIBRARY}"
VENDOR_INCLUDE_DIRS "${NWA_INCLUDE_DIR}" )
VENDOR_LIST "COMPTON"
VENDOR_LIBS "${COMPTON_LIBRARY}"
VENDOR_INCLUDE_DIRS "${COMPTON_INCLUDE_DIR}" )

# ---------------------------------------------------------------------------- #
# Installation instructions
Expand All @@ -79,4 +79,4 @@ endif()

process_autodoc_pages()

endif() # NWA_FOUND
endif() # COMPTON_FOUND
35 changes: 23 additions & 12 deletions src/compton/Compton_NWA.cc → src/compton/Compton.cc
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
//----------------------------------*-C++-*----------------------------------//
/*!
* \file compton/Compton_NWA.cc
* \file compton/Compton.cc
* \author Kendra Keady
* \date Tues Feb 21 2017
* \brief Implementation file for compton NWA interface
* \brief Implementation file for compton CSK_generator interface
* \note Copyright (C) 2017 Los Alamos National Security, LLC.
* All rights reserved. */
//---------------------------------------------------------------------------//

// headers provided in draco:
#include "Compton_NWA.hh"
#include "Compton.hh"
#include "ds++/Assert.hh"
// headers provided in Compton_NWA include directory:
// headers provided in Compton include directory:
#include "compton_file.hh"
#include "multigroup_compton_data.hh"
#include "multigroup_data_types.hh"
Expand All @@ -27,13 +27,13 @@ namespace rtt_compton {
/*!
* \brief Constructor for an existing multigroup libfile.
*
* This calls NWA methods to read the data file and store everything in a
* This calls CSK_generator methods to read the data file and store everything in a
* Compton data object, a smart pointer to which is then passed to (and held by)
* the NWA etemp_interp class.
* the CSK_generator etemp_interp class.
*
* \param filehandle The name of the multigroup file to use for Compton scatters
*/
Compton_NWA::Compton_NWA(const std::string &filehandle) {
Compton::Compton(const std::string &filehandle) {

// Check input validity
Require(std::ifstream(filehandle).good());
Expand All @@ -52,16 +52,16 @@ Compton_NWA::Compton_NWA(const std::string &filehandle) {
/*!
* \brief Constructor for an existing pointwise file and a multigroup structure.
*
* This calls NWA methods to read the pointwise library and construct a
* This calls CSK_generator methods to read the pointwise library and construct a
* multigroup Compton data object, a smart pointer to which is then passed
* to (and held by) the NWA etemp_interp class.
* to (and held by) the CSK_generator etemp_interp class.
*
* \param filehandle The name of the pointwise lib to build MG data from
* \param grp_bds A vector containing the multigroup bounds (in keV)
* \param n_xi The number of angular points/Legendre moments desired
*/
Compton_NWA::Compton_NWA(const std::string &filehandle,
const std::vector<double> &grp_bds, const size_t nxi) {
Compton::Compton(const std::string &filehandle,
const std::vector<double> &grp_bds, const size_t nxi) {

// Check input validity
Require(std::ifstream(filehandle).good());
Expand Down Expand Up @@ -109,7 +109,18 @@ Compton_NWA::Compton_NWA(const std::string &filehandle,
* \return n_grp x n_grp x n_xi interpolated scattering kernel values
*/
std::vector<std::vector<std::vector<double>>>
Compton_NWA::interpolate(const double etemp) {
Compton::interpolate(const double etemp) {

// Be sure the passed electron temperature is within the bounds of the lib!
Require(etemp >= ei->get_min_etemp());
Require(etemp <= ei->get_max_etemp());

// call the appropriate routine in the electron interp object
return ei->interpolate_etemp(etemp);
}

std::vector<std::vector<std::vector<double>>>
Compton::interpolate(const double etemp) const {

// Be sure the passed electron temperature is within the bounds of the lib!
Require(etemp >= ei->get_min_etemp());
Expand Down
Loading

0 comments on commit e772977

Please sign in to comment.