-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create spherical shell in Sphere domain
- Loading branch information
Showing
14 changed files
with
469 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Distributed under the MIT License. | ||
// See LICENSE.txt for details. | ||
|
||
#include "Domain/CoordinateMaps/ShellType.hpp" | ||
|
||
#include <ostream> | ||
#include <string> | ||
|
||
#include "Options/Options.hpp" | ||
#include "Options/ParseOptions.hpp" | ||
#include "Utilities/ErrorHandling/Error.hpp" | ||
|
||
namespace domain::CoordinateMaps { | ||
|
||
std::ostream& operator<<(std::ostream& os, const ShellType shell_type) { | ||
switch (shell_type) { | ||
case ShellType::Cubed: | ||
return os << "Cubed"; | ||
case ShellType::Spherical: | ||
return os << "Spherical"; | ||
default: | ||
ERROR("Unknown domain::CoordinateMaps::ShellType"); | ||
} | ||
} | ||
|
||
} // namespace domain::CoordinateMaps | ||
|
||
template <> | ||
domain::CoordinateMaps::ShellType | ||
Options::create_from_yaml<domain::CoordinateMaps::ShellType>::create<void>( | ||
const Options::Option& options) { | ||
const auto shell_type = options.parse_as<std::string>(); | ||
if (shell_type == "Cubed") { | ||
return domain::CoordinateMaps::ShellType::Cubed; | ||
} else if (shell_type == "Spherical") { | ||
return domain::CoordinateMaps::ShellType::Spherical; | ||
} | ||
PARSE_ERROR(options.context(), "ShellType must be 'Cubed' or 'Spherical'."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Distributed under the MIT License. | ||
// See LICENSE.txt for details. | ||
|
||
#pragma once | ||
|
||
#include <ostream> | ||
|
||
/// \cond | ||
namespace Options { | ||
class Option; | ||
template <typename T> | ||
struct create_from_yaml; | ||
} // namespace Options | ||
/// \endcond | ||
|
||
namespace domain::CoordinateMaps { | ||
|
||
/*! | ||
* \brief Type of spherical shell: built from four (2D) or six (3D) wedges | ||
* ("cubed") or from a single spherical shell ("spherical"). | ||
* | ||
* Used to select the shell type in the input file. | ||
*/ | ||
enum class ShellType { | ||
Cubed, | ||
Spherical, | ||
}; | ||
|
||
std::ostream& operator<<(std::ostream& os, ShellType shell_type); | ||
|
||
} // namespace domain::CoordinateMaps | ||
|
||
template <> | ||
struct Options::create_from_yaml<domain::CoordinateMaps::ShellType> { | ||
template <typename Metavariables> | ||
static domain::CoordinateMaps::ShellType create( | ||
const Options::Option& options) { | ||
return create<void>(options); | ||
} | ||
}; | ||
template <> | ||
domain::CoordinateMaps::ShellType | ||
Options::create_from_yaml<domain::CoordinateMaps::ShellType>::create<void>( | ||
const Options::Option& options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.