Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
3ee919f
Trigger Build
ilfreddy Aug 7, 2024
32cfe5c
documentation done insiede al core folder
Christian48596 Oct 27, 2025
29b5a1f
Done Documentation in functions folder
Christian48596 Oct 27, 2025
063b81d
DONE documentation in the operators folder
Christian48596 Oct 28, 2025
b30b76a
Update BSOperator.h
Christian48596 Oct 28, 2025
6bcfb11
Done doxygen documenttion insiede treebuilders folder
Christian48596 Oct 29, 2025
b450533
Update map.cpp
Christian48596 Oct 29, 2025
e9420da
Done doxygen .h files in trees folder
Christian48596 Oct 29, 2025
5d86c59
Update MultiResolutionAnalysis.h
Christian48596 Oct 29, 2025
b075a8b
Done doxygen documentation in .h files within utils folder
Christian48596 Oct 31, 2025
218178f
Update Bank.cpp
Christian48596 Oct 31, 2025
aee5b78
Done doxygen in .h and removed by .cpp within treebuilders folder
Christian48596 Oct 31, 2025
61569f6
Update TreeBuilder.h
Christian48596 Oct 31, 2025
889d436
updated .h in treebuilders folder
Christian48596 Oct 31, 2025
aba6c0b
updated folder operators only doxygen in .h
Christian48596 Oct 31, 2025
70b8232
udated folder function doxygen documentation only in .h and cleaned …
Christian48596 Oct 31, 2025
5b57471
updated folder core doxygen documetation only in .h files and removed…
Christian48596 Oct 31, 2025
79bd90e
Small fix
ilfreddy Nov 5, 2025
f606f56
Remove some leftover after rebase
ilfreddy Nov 5, 2025
dc1e904
Restore old comments for documenting work
moorberry Nov 6, 2025
2c4a655
Start documenting MWNode
moorberry Nov 6, 2025
0d060b6
Comments HilbertPath
ilfreddy Nov 6, 2025
7111375
Comments HilbertPath
ilfreddy Nov 6, 2025
7cdfeb8
Comments HilbertPath
ilfreddy Nov 6, 2025
4a3b4c1
MWTree documented
msnik1999 Nov 6, 2025
e8887d3
BandWidth documented
msnik1999 Nov 6, 2025
78a27a5
Documents OperatorNode
ilfreddy Nov 6, 2025
6fd2a3e
FuntionTree.h FunctionTree.cpp and FunctionTreeVector.h (yes, for the…
QuantumJacopo137 Nov 6, 2025
6a14eed
BoundingBox documented
msnik1999 Nov 6, 2025
efd88b4
CornerOperatorTree documented
msnik1999 Nov 6, 2025
90965e4
documenting NodeIndex.h
ylvao Nov 6, 2025
1d2ee86
small fixes
ylvao Nov 6, 2025
e139a14
OperatorTree.h OperatorTree.cpp documented!
QuantumJacopo137 Nov 6, 2025
f9d1980
Finish documenting MWNode
moorberry Nov 6, 2025
1a0c0bd
NodeBox documented
msnik1999 Nov 6, 2025
7c536cd
add doxygen comments for FunctionNode
bingao Nov 7, 2025
c3c897e
resolve comments of evalf, dealloc, reCompress, dot_scaling and dot_s…
bingao Nov 10, 2025
77a7a9d
add comment for BoysFunction
bingao Nov 11, 2025
d6c5451
documentation for MRA.h and .cpp (empty line fix in nodeindex.h)
ylvao Nov 12, 2025
f3c2617
AnalyticFunction documented
msnik1999 Nov 12, 2025
7d0a0e3
Documents TreeIterator.h
ilfreddy Nov 13, 2025
5c05207
function_utils both .h .cpp: BUT in the .h there was no instance of t…
QuantumJacopo137 Nov 11, 2025
fd8332d
special_function .h and .cpp documented
QuantumJacopo137 Nov 11, 2025
d42b601
Gaussian .h and .cpp documented
QuantumJacopo137 Nov 11, 2025
f59a497
NodeAllocator.*
QuantumJacopo137 Nov 17, 2025
f1b4ada
GaussFunc documented
msnik1999 Nov 19, 2025
4639986
Merge branch 'master' into documentation
ilfreddy Nov 20, 2025
c0e5175
fixed compilation issues in function_utils
msnik1999 Nov 21, 2025
de6bd6b
Documented GaussPoly
msnik1999 Dec 3, 2025
0da95e2
Documented LegendrePoly
msnik1999 Dec 3, 2025
988a882
add documentation for GaussExp
bingao Dec 12, 2025
4b29459
documented Polynomial.h
msnik1999 Feb 25, 2026
361ae7e
RepresentableFunction.cpp and RepresentableFunction.h done and docume…
QuantumJacopo137 Mar 8, 2026
af78c47
Merge branch 'master' into documentation
ilfreddy Mar 11, 2026
175f6f1
Merge branch 'master' into documentation
ilfreddy Mar 11, 2026
6069335
Merge branch 'master' into documentation
ilfreddy Mar 11, 2026
30d5d56
Removes duplicate line
ilfreddy Mar 11, 2026
c6a8cce
documented AdditionCalculator.h
msnik1999 Apr 9, 2026
a9c8da9
generated documentation for src/core folder using claude code; NEEDS …
msnik1999 May 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 66 additions & 7 deletions src/core/CrossCorrelation.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,88 @@

namespace mrcpp {

/**
* @class CrossCorrelation
* @brief Container and loader for the left and right cross-correlation coefficient matrices
* of a multiwavelet filter family
*
* @details
* Holds two dense matrices associated with the chosen polynomial order \f$ k \f$ (\f$ K = k+1 \f$) and
* filter family #type (Interpol or Legendre):
* \f[
* \mathrm{Left},\,\mathrm{Right} \in \mathbb{R}^{K^2 \times 2K}.
* \f]
* Each row corresponds to a flattened index pair \f$ (i,j) \f$ with \f$ i,j \in \{0,\ldots,K-1\} \f$
* and each row stores a \f$ 2K \f$-wide correlation stencil. Objects are constructed either by loading
* binary coefficient files from disk or by adopting in-memory matrices. There are no mutating public
* methods; the class is a thread-safe value holder once constructed.
*
* @see CrossCorrelationCache for the process-wide singleton that caches these objects by order
*/
class CrossCorrelation final {
public:
/**
* @brief Construct by loading coefficient tables from the MRCPP filter library
* @param k Polynomial order (\f$ k \geq 1 \f$; \f$ K = k+1 \f$)
* @param t Filter family/type code (Interpol or Legendre)
*
* @details Discovers the library path via details::find_filters(), selects files by @p t and @p k,
* and reads them into #Left and #Right
*
* @note Aborts via MSG_ABORT if @p k or @p t is invalid or the files cannot be opened
*/
CrossCorrelation(int k, int t);

/**
* @brief Construct from in-memory matrices without file I/O
* @param t Filter family/type code
* @param[in] ldata Left matrix of size \f$ K^2 \times 2K \f$
* @param[in] rdata Right matrix of size \f$ K^2 \times 2K \f$ (must match dimensions of @p ldata)
*
* @details The polynomial order is inferred as \f$ k = \text{ldata.cols()}/2 - 1 \f$
*
* @note Aborts if dimensions are inconsistent or the type is invalid
*/
CrossCorrelation(int t, const Eigen::MatrixXd &ldata, const Eigen::MatrixXd &rdata);

/** @return The filter family/type code associated with this object */
int getType() const { return this->type; }

/** @return The polynomial order k (so K = k + 1) */
int getOrder() const { return this->order; }

/** @return Const reference to the left cross-correlation matrix */
const Eigen::MatrixXd &getLMatrix() const { return this->Left; }

/** @return Const reference to the right cross-correlation matrix */
const Eigen::MatrixXd &getRMatrix() const { return this->Right; }

protected:
int type;
int order;
int type; ///< Filter family/type code (Interpol or Legendre; see constants.h)
int order; ///< Polynomial order \f$ k \f$ (\f$ K = k+1 \f$; controls matrix dimensions \f$ K^2 \times 2K \f$)

Eigen::MatrixXd Left;
Eigen::MatrixXd Right;
Eigen::MatrixXd Left; ///< Left cross-correlation matrix of size \f$ K^2 \times 2K \f$
Eigen::MatrixXd Right; ///< Right cross-correlation matrix of size \f$ K^2 \times 2K \f$

private:
/**
* @brief Compose the on-disk paths to the left and right binary tables
* @param[in] lib Root directory of the MRCPP filter library
*
* @details Sets #L_path and #R_path using family-specific naming conventions based on #type and #order
*/
void setCCCPaths(const std::string &lib);

/**
* @brief Read the binary coefficient tables from disk into #Left and #Right
*
* @details Reads two files whose paths are stored in #L_path and #R_path. Each file contains
* \f$ K^2 \f$ rows of \f$ 2K \f$ doubles. Values smaller than MachinePrec are zeroed.
*/
void readCCCBin();

std::string L_path;
std::string R_path;
std::string L_path; ///< Full path to the left coefficient binary file (resolved at construction)
std::string R_path; ///< Full path to the right coefficient binary file (resolved at construction)
};

} // namespace mrcpp
} // namespace mrcpp
65 changes: 0 additions & 65 deletions src/core/CrossCorrelationCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,71 +76,6 @@ template <int T> const Eigen::MatrixXd &CrossCorrelationCache<T>::getLMatrix(int
}


/** @brief Fetches the cross correlation coefficients.
*
* @param[in] order: Dimension of \f$ V_0 \subset L^2(\mathbb R) \f$ minus one,
* that is the maximum degree \f$ k \f$ of polynomials in \f$ V_0 \subset L^2(0, 1) \f$.
* @returns The right matrix of cross correlation coefficients.
*
* @details The cross correlation coefficients
* \f[
* C^{(+)}_{ijp}
* =
* \int_0^1 dz
* \int_0^1 dx
* \phi_i(x)
* \phi_j(x - z)
* \phi_p(z)
* \f]
* with \f$ i, j = 0, \ldots, k \f$ and \f$ p = 0, \ldots, 2k + 1 \f$.
* They are grouped in the so called right matrix
* \f[
* \begin{pmatrix}
* C^{(+)}_{000}
* &
* C^{(+)}_{001}
* &
* \ldots
* &
* C^{(+)}_{00,2k+1}
* \\
* C^{(+)}_{010}
* &
* C^{(+)}_{011}
* &
* \ldots
* &
* C^{(+)}_{01,2k+1}
* \\
* \ldots
* &
* \ldots
* &
* \ldots
* &
* \ldots
* \\
* C^{(+)}_{k, k - 1, 0}
* &
* C^{(+)}_{k, k - 1, 1}
* &
* \ldots
* &
* C^{(+)}_{k, k - 1, 2k+1}
* \\
* C^{(+)}_{kk0}
* &
* C^{(+)}_{kk1}
* &
* \ldots
* &
* C^{(+)}_{kk,2k+1}
* \end{pmatrix}
* \f]
* that is returned by the method.
*
*
*/
template <int T> const Eigen::MatrixXd &CrossCorrelationCache<T>::getRMatrix(int order) {
if (not hasId(order)) { load(order); }
return ObjectCache<CrossCorrelation>::get(order).getRMatrix();
Expand Down
80 changes: 77 additions & 3 deletions src/core/CrossCorrelationCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,103 @@

namespace mrcpp {

/**
* @def getCrossCorrelationCache(T, X)
* @brief Bind a local reference @p X to the singleton CrossCorrelationCache<T>
*
* @details Expands to <tt>CrossCorrelationCache<T> &X = CrossCorrelationCache<T>::getInstance()</tt>
* Example: <tt>getCrossCorrelationCache(Interpol, ccc); const auto& L = ccc.getLMatrix(order);</tt>
*/
#define getCrossCorrelationCache(T, X) CrossCorrelationCache<T> &X = CrossCorrelationCache<T>::getInstance()

/**
* @class CrossCorrelationCache
* @brief Thread-safe cache for @ref CrossCorrelation objects, keyed by order
*
* This cache avoids repeatedly loading the (potentially large) left/right
* cross-correlation matrices from disk. One cache instance exists per filter
* family, realized as a template parameter @p T (e.g., Interpol or Legendre).
*
* Design notes:
* - Singleton pattern (Meyers singleton) per @p T via getInstance().
* - Inherits from @ref ObjectCache<CrossCorrelation>, which provides the
* generic cache interface (load/get/hasId etc.).
* - Actual loading and synchronization details are implemented in the
* corresponding .cpp; OpenMP locks guard first-time insertions.
*
* @tparam T Filter family tag (int constant), e.g. Interpol or Legendre
*/
template <int T> class CrossCorrelationCache final : public ObjectCache<CrossCorrelation> {
public:
/**
* @brief Access the unique cache instance for the template family @p T
*
* Uses a function-local static (Meyers singleton). Thread-safe in C++11+.
*/
static CrossCorrelationCache<T> &getInstance() {
static CrossCorrelationCache<T> theCrossCorrelationCache;
return theCrossCorrelationCache;
}

/**
* @brief Ensure that the entry for @p order is present in the cache
*
* If absent, constructs a new @ref CrossCorrelation(order, type) and
* inserts it. See .cpp for locking and memory accounting.
*/
void load(int order) override;

/**
* @brief Retrieve the cached @ref CrossCorrelation for @p order
*
* Loads on demand if missing. Returns a reference owned by the cache.
*/
CrossCorrelation &get(int order) override;

/**
* @brief Convenience accessor returning the Left cross-correlation matrix for a given order
* @param order Polynomial order k
* @return Const reference to the left matrix (lazy-loads the entry if absent)
*/
const Eigen::MatrixXd &getLMatrix(int order);

/**
* @brief Convenience accessor returning the Right cross-correlation matrix for a given order
* @param order Polynomial order \f$ k \f$
* @return Const reference to the right cross-correlation coefficient matrix (lazy-loads if absent)
*
* @details The right matrix collects the cross-correlation coefficients
* \f[
* C^{(+)}_{ijp} = \int_0^1 dz \int_0^1 dx\, \phi_i(x)\, \phi_j(x-z)\, \phi_p(z)
* \f]
* with \f$ i,j = 0,\ldots,k \f$ and \f$ p = 0,\ldots,2k+1 \f$, arranged row-wise with the
* flattened \f$(i,j)\f$ index as the row and \f$ p \f$ as the column index
*/
const Eigen::MatrixXd &getRMatrix(int order);

/**
* @brief Filter family/type code associated with this cache
*
* Set in the private constructor based on the template parameter @p T.
* (E.g., Interpol or Legendre.)
*/
int getType() const { return this->type; }

protected:
int type;
std::string libPath; ///< Base path to filter library
int type; ///< Filter family/type code matching template parameter @p T (e.g., Interpol or Legendre)
std::string libPath; ///< Reserved base path for the filter library (path resolution is currently delegated to CrossCorrelation)

private:
/**
* @brief Private constructor enforces the singleton pattern
*
* Initializes @ref type based on T; see .cpp for validation.
*/
CrossCorrelationCache();

// Non-copyable / non-assignable — keeps the singleton unique.
CrossCorrelationCache(CrossCorrelationCache<T> const &ccc) = delete;
CrossCorrelationCache<T> &operator=(CrossCorrelationCache<T> const &ccc) = delete;
};

} // namespace mrcpp
} // namespace mrcpp
77 changes: 60 additions & 17 deletions src/core/FilterCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@
* <https://mrcpp.readthedocs.io/>
*/

/*
*
* \breif FilterCache is a static class taking care of loading and
* unloading MultiWavelet filters, and their tensor counter parts.
*
* All data in FilterCache is static, and thus shared amongst all
* instance objects. The type of filter, Legendre or Interpolating is
* determined by a template variable so that both types of filters can
* co-exist.
*
*/

#pragma once

#include "MWFilter.h"
Expand All @@ -45,38 +33,93 @@

namespace mrcpp {

/**
* @def getFilterCache(T, X)
* @brief Bind a local reference @p X to the singleton FilterCache<T>
*
* @details Expands to <tt>FilterCache<T> &X = FilterCache<T>::getInstance()</tt>
*/

/**
* @def getLegendreFilterCache(X)
* @brief Convenience shorthand for @ref getFilterCache with the Legendre family
*/

/**
* @def getInterpolatingFilterCache(X)
* @brief Convenience shorthand for @ref getFilterCache with the Interpol family
*/
#define getFilterCache(T, X) FilterCache<T> &X = FilterCache<T>::getInstance()
#define getLegendreFilterCache(X) FilterCache<Legendre> &X = FilterCache<Legendre>::getInstance()
#define getInterpolatingFilterCache(X) FilterCache<Interpol> &X = FilterCache<Interpol>::getInstance()

/** This class is an abstract base class for the various filter caches.
* It's needed in order to be able to use the actual filter caches
* without reference to the actual filter types */
/**
* @class BaseFilterCache
* @brief Non-templated abstract interface over the filter cache hierarchy
*
* @details Callers that do not know the filter family at compile time can interact with any FilterCache<T>
* through this base class. Inherits from ObjectCache<MWFilter> for generic index-addressed storage,
* and declares pure virtual load(), get(), and getFilterMatrix() for family-specific implementations.
*/
class BaseFilterCache : public ObjectCache<MWFilter> {
public:
/// Ensure the filter for @p order exists in the cache (lazy load if needed)
void load(int order) override = 0;

/// Retrieve the cached MWFilter for @p order (loads it on demand)
MWFilter &get(int order) override = 0;

/// Convenience accessor: return the filter matrix (const) for @p order
virtual const Eigen::MatrixXd &getFilterMatrix(int order) = 0;
};

/**
* @class FilterCache
* @tparam T Integer tag selecting the filter family (Interpol or Legendre)
* @brief Process-wide singleton cache for MWFilter objects keyed by polynomial order
*
* @details One instance exists per family @p T (Meyers singleton via getInstance()). First-time loads
* construct MWFilter(order, type) under an OpenMP lock; subsequent reads are lock-free. Copy and
* assignment are deleted to enforce singleton semantics.
*
* @see MWFilter for the cached object type
* @see BaseFilterCache for the non-templated interface
*/
template <int T> class FilterCache final : public BaseFilterCache {
public:
/**
* @brief Access the singleton cache for the template family T
*
* The instance is created on first use and lives until program exit
*/
static FilterCache &getInstance() {
static FilterCache theFilterCache;
return theFilterCache;
}

/// Ensure entry for @p order exists; loads it if missing (see .cpp)
void load(int order) override;

/// Retrieve the MWFilter for @p order; loads it if missing
MWFilter &get(int order) override;

/// Convenience accessor returning a const reference to the filter matrix
const Eigen::MatrixXd &getFilterMatrix(int order) override;

protected:
int type;
int type; ///< Runtime family/type code derived from template parameter @p T; passed to MWFilter(order, type)

private:
/**
* @brief Private constructor enforces the singleton pattern
*
* @details Sets #type from @p T and performs minimal family-specific validation (see .cpp)
*/
FilterCache();

// Non-copyable and non-assignable to maintain single instance semantics.
FilterCache(FilterCache<T> const &fc) = delete;
FilterCache &operator=(FilterCache<T> const &fc) = delete;
};

} // namespace mrcpp
} // namespace mrcpp
Loading