Skip to content

Commit

Permalink
Rename ORANGE construction files (#1106)
Browse files Browse the repository at this point in the history
* Rename transform inserter
* Rename orange construct source files
* Update include paths
* Update test locations
* Update cmake
* Update namespaces
* Address feedback
  • Loading branch information
sethrj committed Feb 13, 2024
1 parent ddb329e commit 276c2cd
Show file tree
Hide file tree
Showing 50 changed files with 206 additions and 192 deletions.
3 changes: 2 additions & 1 deletion app/orange-update.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file orange-update.cc
//! \brief Read in and write back an ORANGE JSON file
//---------------------------------------------------------------------------//
#include <cstdlib>
#include <fstream>
Expand All @@ -21,7 +22,7 @@
# include <fstream>
# include <nlohmann/json.hpp>

# include "orange/construct/OrangeInputIO.json.hh"
# include "orange/OrangeInputIO.json.hh"
#endif

namespace celeritas
Expand Down
3 changes: 2 additions & 1 deletion doc/main/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ orange-update
-------------

Read an ORANGE JSON input file and write it out again. This is used for
updating from an older version of the input to a newer version.
updating from an older version of the input (i.e. with different parameter
names or fewer options) to a newer version.

----

Expand Down
18 changes: 9 additions & 9 deletions src/orange/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ list(APPEND SOURCES
OrangeParams.cc
OrangeParamsOutput.cc
OrangeTypes.cc
construct/CsgTree.cc
construct/CsgTypes.cc
construct/CsgTreeUtils.cc
construct/DepthCalculator.cc
construct/detail/LocalSurfaceInserter.cc
construct/detail/NodeSimplifier.cc
detail/BIHBuilder.cc
detail/BIHPartitioner.cc
detail/DepthCalculator.cc
detail/RectArrayInserter.cc
detail/SurfacesRecordBuilder.cc
detail/UnitInserter.cc
detail/UniverseInserter.cc
orangeinp/CsgTree.cc
orangeinp/CsgTypes.cc
orangeinp/CsgTreeUtils.cc
orangeinp/detail/BoundingZone.cc
orangeinp/detail/CsgUnitBuilder.cc
orangeinp/detail/LocalSurfaceInserter.cc
orangeinp/detail/NodeSimplifier.cc
surf/ConeAligned.cc
surf/CylAligned.cc
surf/FaceNamer.cc
Expand All @@ -55,9 +55,9 @@ list(APPEND SOURCES

if(CELERITAS_USE_JSON)
list(APPEND SOURCES
construct/CsgTreeIO.json.cc
construct/OrangeInputIO.json.cc
construct/detail/OrangeInputIOImpl.json.cc
OrangeInputIO.json.cc
detail/OrangeInputIOImpl.json.cc
orangeinp/CsgTreeIO.json.cc
)
list(APPEND PRIVATE_DEPS nlohmann_json::nlohmann_json)
endif()
Expand Down
2 changes: 2 additions & 0 deletions src/orange/OrangeData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ struct UniverseIndexerData
//---------------------------------------------------------------------------//
/*!
* Persistent data used by all BIH trees.
*
* \todo move to orange/BihTreeData
*/
template<Ownership W, MemSpace M>
struct BIHTreeData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file orange/construct/OrangeInput.hh
//! \file orange/OrangeInput.hh
//---------------------------------------------------------------------------//
#pragma once

Expand All @@ -14,10 +14,11 @@

#include "corecel/io/Label.hh"
#include "geocel/BoundingBox.hh"
#include "orange/OrangeData.hh"
#include "orange/OrangeTypes.hh"
#include "orange/surf/VariantSurface.hh"
#include "orange/transform/VariantTransform.hh"

#include "OrangeData.hh"
#include "OrangeTypes.hh"
#include "surf/VariantSurface.hh"
#include "transform/VariantTransform.hh"

namespace celeritas
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file orange/construct/OrangeInputIO.json.cc
//! \file orange/OrangeInputIO.json.cc
//---------------------------------------------------------------------------//
#include "OrangeInputIO.json.hh"

Expand All @@ -25,11 +25,11 @@
#include "corecel/io/LabelIO.json.hh"
#include "corecel/io/Logger.hh"
#include "geocel/BoundingBoxIO.json.hh"
#include "orange/OrangeTypes.hh"
#include "orange/surf/SurfaceTypeTraits.hh"

#include "OrangeInput.hh"
#include "OrangeTypes.hh"
#include "detail/OrangeInputIOImpl.json.hh"
#include "surf/SurfaceTypeTraits.hh"

namespace celeritas
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file orange/construct/OrangeInputIO.json.hh
//! \file orange/OrangeInputIO.json.hh
//---------------------------------------------------------------------------//
#pragma once

#include <nlohmann/json.hpp>

#include "orange/OrangeData.hh"

#include "OrangeData.hh"
#include "OrangeInput.hh"

namespace celeritas
Expand Down
6 changes: 3 additions & 3 deletions src/orange/OrangeParams.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include "geocel/BoundingBox.hh"

#include "OrangeData.hh" // IWYU pragma: associated
#include "OrangeInput.hh"
#include "OrangeTypes.hh"
#include "construct/DepthCalculator.hh"
#include "construct/OrangeInput.hh"
#include "detail/DepthCalculator.hh"
#include "detail/RectArrayInserter.hh"
#include "detail/UnitInserter.hh"
#include "detail/UniverseInserter.hh"
Expand All @@ -37,7 +37,7 @@
#if CELERITAS_USE_JSON
# include <nlohmann/json.hpp>

# include "construct/OrangeInputIO.json.hh"
# include "OrangeInputIO.json.hh"
#endif

namespace celeritas
Expand Down
2 changes: 1 addition & 1 deletion src/orange/OrangeParamsOutput.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# include <nlohmann/json.hpp>

// TODO: Tolerance is defined in OrangeTypes but IO is here
# include "construct/OrangeInputIO.json.hh"
# include "OrangeInputIO.json.hh"
#endif

namespace celeritas
Expand Down
3 changes: 3 additions & 0 deletions src/orange/detail/BIHData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file orange/detail/BIHData.hh
//! \todo move to orange/BihTreeData
//---------------------------------------------------------------------------//
#pragma once

Expand Down Expand Up @@ -74,6 +75,8 @@ struct BIHLeafNode
* Bounding Interval Hierarchy tree.
*
* Infinite bounding boxes are not included in the main tree.
*
* \todo Rename BihTreeRecord
*/
struct BIHTree
{
Expand Down
4 changes: 3 additions & 1 deletion src/orange/detail/BIHTraverser.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace detail
//---------------------------------------------------------------------------//
/*!
* Traverse BIH tree using a depth-first search.
*
* \todo move to top-level orange directory out of detail namespace
*/
class BIHTraverser
{
Expand All @@ -29,7 +31,7 @@ class BIHTraverser
//!@}

// Construct from vector of bounding boxes and storage for LocalVolumeIds
explicit inline CELER_FUNCTION
inline CELER_FUNCTION
BIHTraverser(BIHTree const& tree, Storage const& storage);

// Point-in-volume operation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file orange/construct/DepthCalculator.cc
//! \file orange/detail/DepthCalculator.cc
//---------------------------------------------------------------------------//
#include "DepthCalculator.hh"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file orange/construct/DepthCalculator.hh
//! \file orange/detail/DepthCalculator.hh
//---------------------------------------------------------------------------//
#pragma once

Expand All @@ -12,7 +12,7 @@

#include "corecel/cont/VariantUtils.hh"

#include "OrangeInput.hh"
#include "../OrangeInput.hh"

namespace celeritas
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file orange/construct/detail/OrangeInputIOImpl.json.cc
//! \file orange/detail/OrangeInputIOImpl.json.cc
//---------------------------------------------------------------------------//
#include "OrangeInputIOImpl.json.hh"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file orange/construct/detail/OrangeInputIOImpl.json.hh
//! \file orange/detail/OrangeInputIOImpl.json.hh
//---------------------------------------------------------------------------//
#pragma once

#include <string>
#include <vector>
#include <nlohmann/json.hpp>

#include "orange/OrangeTypes.hh"
#include "orange/surf/VariantSurface.hh"
#include "orange/transform/VariantTransform.hh"
#include "../OrangeTypes.hh"
#include "../surf/VariantSurface.hh"
#include "../transform/VariantTransform.hh"

namespace celeritas
{
Expand Down
2 changes: 1 addition & 1 deletion src/orange/detail/RectArrayInserter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "corecel/data/Collection.hh"

#include "UniverseInserter.hh"
#include "../construct/OrangeInput.hh"
#include "../OrangeInput.hh"

namespace celeritas
{
Expand Down
6 changes: 3 additions & 3 deletions src/orange/detail/RectArrayInserter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include "corecel/data/CollectionBuilder.hh"
#include "corecel/data/DedupeCollectionBuilder.hh"

#include "TransformInserter.hh"
#include "TransformRecordInserter.hh"
#include "../OrangeData.hh"
#include "../OrangeInput.hh"
#include "../OrangeTypes.hh"
#include "../construct/OrangeInput.hh"

namespace celeritas
{
Expand Down Expand Up @@ -42,7 +42,7 @@ class RectArrayInserter

private:
Data* orange_data_{nullptr};
TransformInserter insert_transform_;
TransformRecordInserter insert_transform_;
UniverseInserter* insert_universe_;

CollectionBuilder<RectArrayRecord> rect_arrays_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the top-level COPYRIGHT file for details.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
//---------------------------------------------------------------------------//
//! \file orange/detail/TransformInserter.hh
//! \file orange/detail/TransformRecordInserter.hh
//---------------------------------------------------------------------------//
#pragma once

Expand All @@ -26,7 +26,7 @@ namespace detail
* TODO: deduplicate transforms via hashes? Define special compressed transform
* for 90-degree rotations?
*/
class TransformInserter
class TransformRecordInserter
{
public:
//!@{
Expand All @@ -37,8 +37,8 @@ class TransformInserter

public:
// Construct with pointers to target data
inline TransformInserter(Items<TransformRecord>* transforms,
Items<real_type>* reals);
inline TransformRecordInserter(Items<TransformRecord>* transforms,
Items<real_type>* reals);

// Return a transform ID from a transform variant
inline TransformId operator()(VariantTransform const& tr);
Expand All @@ -59,8 +59,8 @@ class TransformInserter
/*!
* Construct with pointers to target data.
*/
TransformInserter::TransformInserter(Items<TransformRecord>* transforms,
Items<real_type>* reals)
TransformRecordInserter::TransformRecordInserter(
Items<TransformRecord>* transforms, Items<real_type>* reals)
: transforms_{transforms}, reals_{reals}
{
CELER_EXPECT(transforms && reals);
Expand All @@ -70,7 +70,7 @@ TransformInserter::TransformInserter(Items<TransformRecord>* transforms,
/*!
* Construct from a transform variant.
*/
TransformId TransformInserter::operator()(VariantTransform const& tr)
TransformId TransformRecordInserter::operator()(VariantTransform const& tr)
{
CELER_ASSUME(!tr.valueless_by_exception());
return std::visit(*this, tr);
Expand All @@ -81,7 +81,7 @@ TransformId TransformInserter::operator()(VariantTransform const& tr)
* Construct from a transform with a known type.
*/
template<class T>
TransformId TransformInserter::operator()(T const& tr)
TransformId TransformRecordInserter::operator()(T const& tr)
{
// TODO: add equality and hash for TransformRecord and replace this with
// just a dedupe collection builder
Expand Down
2 changes: 1 addition & 1 deletion src/orange/detail/UnitInserter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "UniverseInserter.hh"
#include "../BoundingBoxUtils.hh"
#include "../construct/OrangeInput.hh"
#include "../OrangeInput.hh"
#include "../surf/LocalSurfaceVisitor.hh"

namespace celeritas
Expand Down
6 changes: 3 additions & 3 deletions src/orange/detail/UnitInserter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

#include "BIHBuilder.hh"
#include "SurfacesRecordBuilder.hh"
#include "TransformInserter.hh"
#include "TransformRecordInserter.hh"
#include "../OrangeData.hh"
#include "../OrangeInput.hh"
#include "../OrangeTypes.hh"
#include "../construct/OrangeInput.hh"

namespace celeritas
{
Expand Down Expand Up @@ -47,7 +47,7 @@ class UnitInserter
private:
Data* orange_data_{nullptr};
BIHBuilder build_bih_tree_;
TransformInserter insert_transform_;
TransformRecordInserter insert_transform_;
SurfacesRecordBuilder build_surfaces_;
UniverseInserter* insert_universe_;

Expand Down

0 comments on commit 276c2cd

Please sign in to comment.