-
Notifications
You must be signed in to change notification settings - Fork 19
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
Added doc to MultiResolutionAnalysis.cpp #228
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
460de97
Added doc to MultiResolutionAnalysis.cpp@
072698b
added index file for doc of MRA class
a3b9db5
added index file for doc of MRA class
7fb9db5
Updated overview.rst to correct MRA class name, and changed mra.rst t…
7cedabc
Apply suggestions from Roberto
Dheasra 4cc346f
Fill in missing filter doc in MRA class
stigrj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
------------------ | ||
MultiResolutionAnalysis | ||
------------------ | ||
|
||
The MultiResolutionAnalysis (MRA) class contains the methods to project objects onto the spatial grid. | ||
That is, to combine different functions and operators in mathematical operations, they need to be compatible; | ||
they must be defined on the same computational domain and constructed using the same polynomial basis | ||
(order and type). This information constitutes an MRA, which needs to be defined and passed as argument to | ||
all function and operator constructors, and only functions and operators with compatible MRAs can be | ||
combined in subsequent calculations. | ||
|
||
.. doxygenclass:: mrcpp::MultiResolutionAnalysis | ||
:members: | ||
:protected-members: | ||
:private-members: | ||
|
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 |
---|---|---|
|
@@ -32,6 +32,22 @@ | |
|
||
namespace mrcpp { | ||
|
||
/** @returns New MultiResolutionAnalysis (MRA) object | ||
* | ||
* @brief Constructs a MultiResolutionAnalysis object composed of computational domain (world) and a polynomial basis (Multiwavelets) | ||
* | ||
* @param[in] bb: 2-element integer array [Lower, Upper] defining the bounds for a BoundingBox object representing the computational domain | ||
* @param[in] order: Maximum polynomial order of the multiwavelet basis, | ||
* immediately used in the constructor of an InterPolatingBasis object which becomes an attribute of the MRA | ||
* @param[in] maxDepth: Exponent of the node refinement in base 2, relative to root scale. | ||
* In other words, it is the maximum amount of refinement that we allow in a node, in other to avoid overflow of values. | ||
* | ||
* @details Constructor of the MultiResolutionAnalysis class from scratch, without requiring any pre-existing complex structure. | ||
* The constructor calls the InterpolatingBasis basis constructor to generate the MultiWavelets basis of functions, | ||
* then the BoundingBox constructor to create the computational domain. The constructor then checks if the generated node depth, or | ||
* node refinement is beyond the root scale or the maximum depth allowed, in which case it will abort the process. | ||
* Otherwise, the process goes on to setup the filters with the class' setupFilter method. | ||
*/ | ||
template <int D> | ||
MultiResolutionAnalysis<D>::MultiResolutionAnalysis(std::array<int, 2> bb, int order, int depth) | ||
: maxDepth(depth) | ||
|
@@ -42,6 +58,18 @@ MultiResolutionAnalysis<D>::MultiResolutionAnalysis(std::array<int, 2> bb, int o | |
setupFilter(); | ||
} | ||
|
||
/** @returns New MultiResolutionAnalysis (MRA) object | ||
* | ||
* @brief Constructs a MultiResolutionAnalysis object composed of computational domain (world) and a polynomial basis (Multiwavelets) from a pre-existing BoundingBox object | ||
* | ||
* @param[in] bb: BoundingBox object representing the computational domain | ||
* @param[in] order: (integer) Maximum polynomial order of the multiwavelet basis, | ||
* immediately used in the constructor of an InterPolatingBasis object which becomes an attribute of the MRA | ||
* @param[in] maxDepth: (integer) Exponent of the node refinement in base 2, relative to root scale. | ||
* In other words, it is the maximum amount of refinement that we allow in a node, in other to avoid overflow of values. | ||
* | ||
* @details Constructor of the MultiResolutionAnalysis class from a BoundingBox object. For more details see the first constructor. | ||
*/ | ||
template <int D> | ||
MultiResolutionAnalysis<D>::MultiResolutionAnalysis(const BoundingBox<D> &bb, int order, int depth) | ||
: maxDepth(depth) | ||
|
@@ -52,6 +80,14 @@ MultiResolutionAnalysis<D>::MultiResolutionAnalysis(const BoundingBox<D> &bb, in | |
setupFilter(); | ||
} | ||
|
||
/** @returns New MultiResolutionAnalysis (MRA) object | ||
* | ||
* @brief Copy constructor for a MultiResolutionAnalysis object composed of computational domain (world) and a polynomial basis (Multiwavelets) | ||
* | ||
* @param[in] mra: Pre-existing MRA object | ||
* | ||
* @details Copy a MultiResolutionAnalysis object without modifying the original. For more details see the first constructor. | ||
*/ | ||
template <int D> | ||
MultiResolutionAnalysis<D>::MultiResolutionAnalysis(const MultiResolutionAnalysis<D> &mra) | ||
: maxDepth(mra.maxDepth) | ||
|
@@ -63,9 +99,14 @@ MultiResolutionAnalysis<D>::MultiResolutionAnalysis(const MultiResolutionAnalysi | |
} | ||
|
||
/** @returns New MultiResolutionAnalysis object | ||
* @param[in] bb: Computational domain | ||
* @param[in] sb: Polynomial basis | ||
* | ||
* @brief Constructor for a MultiResolutionAnalysis object from a pre-existing BoundingBox (computational domain) and a ScalingBasis (Multiwavelet basis) objects | ||
* | ||
* @param[in] bb: Computational domain as a BoundingBox object, taken by constant reference | ||
* @param[in] sb: Polynomial basis (MW) as a ScalingBasis object | ||
* @param[in] depth: Maximum allowed resolution depth, relative to root scale | ||
* | ||
* @details Creates a MRA object from pre-existing BoundingBox and ScalingBasis objects. These objects are taken as reference. For more details about the constructor itself, see the first constructor. | ||
*/ | ||
template <int D> | ||
MultiResolutionAnalysis<D>::MultiResolutionAnalysis(const BoundingBox<D> &bb, const ScalingBasis &sb, int depth) | ||
|
@@ -77,20 +118,45 @@ MultiResolutionAnalysis<D>::MultiResolutionAnalysis(const BoundingBox<D> &bb, co | |
setupFilter(); | ||
} | ||
|
||
/** @returns Whether the two MRA objects are equal. | ||
* | ||
* @brief Equality operator for the MultiResolutionAnalysis class, returns true if both MRAs have the same polynomial basis, computational domain and maximum depth, and false otherwise | ||
* | ||
* @param[in] mra: MRA object, taken by constant reference | ||
* | ||
* @details Equality operator for the MultiResolutionAnalysis class, returns true if both MRAs have the same polynomial basis represented by a BoundingBox object, computational domain (ScalingBasis object) and maximum depth (integer), and false otherwise. | ||
* Computations on different MRA cannot be combined, this operator can be used to make sure that the multiple MRAs are compatible. | ||
* For more information about the meaning of equality for BoundingBox and ScalingBasis objets, see their respective classes. | ||
*/ | ||
template <int D> bool MultiResolutionAnalysis<D>::operator==(const MultiResolutionAnalysis<D> &mra) const { | ||
if (this->basis != mra.basis) return false; | ||
if (this->world != mra.world) return false; | ||
if (this->maxDepth != mra.maxDepth) return false; | ||
return true; | ||
} | ||
|
||
/** @returns Whether the two MRA objects are not equal. | ||
* | ||
* @brief Inequality operator for the MultiResolutionAnalysis class, returns false if both MRAs have the same polynomial basis, computational domain and maximum depth, and true otherwise | ||
* | ||
* @param[in] mra: MRA object, taken by constant reference | ||
* | ||
* @details Inequality operator for the MultiResolutionAnalysis class, returns true if both MRAs have the same polynomial basis represented by a BoundingBox object, computational domain (ScalingBasis object) and maximum depth (integer), and false otherwise. | ||
* Opposite of the == operator. | ||
* For more information about the meaning of equality for BoundingBox and ScalingBasis objets, see their respective classes. | ||
*/ | ||
template <int D> bool MultiResolutionAnalysis<D>::operator!=(const MultiResolutionAnalysis<D> &mra) const { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now that I see this, it seems duplicated... Usually either one implements |
||
if (this->basis != mra.basis) return true; | ||
if (this->world != mra.world) return true; | ||
if (this->maxDepth != mra.maxDepth) return true; | ||
return false; | ||
return !(*this == mra); | ||
} | ||
|
||
/** | ||
* | ||
* @brief Displays the MRA's attributes in the outstream defined in the Printer class | ||
* | ||
* @details This function displays the attributes of the MRA in the using the Printer class. | ||
* By default, the Printer class writes all information in the output file, not the terminal. | ||
* | ||
*/ | ||
template <int D> void MultiResolutionAnalysis<D>::print() const { | ||
print::separator(0, ' '); | ||
print::header(0, "MultiResolution Analysis"); | ||
|
@@ -100,6 +166,15 @@ template <int D> void MultiResolutionAnalysis<D>::print() const { | |
print::separator(0, '=', 2); | ||
} | ||
|
||
/** | ||
* | ||
* @brief Initializes the MW filters for the given MW basis. | ||
* | ||
* @details By calling the get() function for the appropriate MW basis, the global | ||
* FilterCache Singleton object is initialized. Any subsequent reference to this | ||
* particular filter will point to the same unique global object. | ||
* | ||
*/ | ||
template <int D> void MultiResolutionAnalysis<D>::setupFilter() { | ||
getLegendreFilterCache(lfilters); | ||
getInterpolatingFilterCache(ifilters); | ||
|
@@ -117,6 +192,11 @@ template <int D> void MultiResolutionAnalysis<D>::setupFilter() { | |
} | ||
} | ||
|
||
/** @returns Maximum possible distance between two points in the MRA domain | ||
* | ||
* @brief Computes the difference between the lower and upper bounds of the computational domain | ||
* | ||
*/ | ||
template <int D> double MultiResolutionAnalysis<D>::calcMaxDistance() const { | ||
const Coord<D> &lb = getWorldBox().getLowerBounds(); | ||
const Coord<D> &ub = getWorldBox().getUpperBounds(); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here about adding the types to the parameter documentation