Skip to content

Commit

Permalink
Added doc to MultiResolutionAnalysis.cpp@
Browse files Browse the repository at this point in the history
  • Loading branch information
Dheasra committed Nov 7, 2023
1 parent f8def0a commit 62aec75
Showing 1 changed file with 86 additions and 2 deletions.
88 changes: 86 additions & 2 deletions src/trees/MultiResolutionAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@

namespace mrcpp {

/** @returns New MultiResolutionAnalysis (MRA) object
*
* @brief Contructs 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: (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 Contructor 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)
Expand All @@ -42,6 +58,18 @@ MultiResolutionAnalysis<D>::MultiResolutionAnalysis(std::array<int, 2> bb, int o
setupFilter();
}

/** @returns New MultiResolutionAnalysis (MRA) object
*
* @brief Contructs 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 Contructor 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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -77,20 +118,48 @@ MultiResolutionAnalysis<D>::MultiResolutionAnalysis(const BoundingBox<D> &bb, co
setupFilter();
}

/** @returns Boolean value
*
* @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 Boolean value
*
* @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 {
if (this->basis != mra.basis) return true;
if (this->world != mra.world) return true;
if (this->maxDepth != mra.maxDepth) return true;
return false;
}

/** @returns void
*
* @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");
Expand All @@ -100,6 +169,13 @@ template <int D> void MultiResolutionAnalysis<D>::print() const {
print::separator(0, '=', 2);
}

/** @returns void
*
* @brief TODO: Sets up the filters
*
* @details TBD
*
*/
template <int D> void MultiResolutionAnalysis<D>::setupFilter() {
getLegendreFilterCache(lfilters);
getInterpolatingFilterCache(ifilters);
Expand All @@ -117,6 +193,14 @@ template <int D> void MultiResolutionAnalysis<D>::setupFilter() {
}
}

/** @returns double (double-precision floating point number)
*
* @brief Computes the difference between the lower and upper bounds of the computational domain
*
* @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> double MultiResolutionAnalysis<D>::calcMaxDistance() const {
const Coord<D> &lb = getWorldBox().getLowerBounds();
const Coord<D> &ub = getWorldBox().getUpperBounds();
Expand Down

0 comments on commit 62aec75

Please sign in to comment.