Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
64e20e8
First LinearOperator class implementation
rubenzorrilla Nov 6, 2025
7396076
Merge branch 'master' into core/future-linear-operator
rubenzorrilla Nov 23, 2025
b288bea
Merge branch 'master' into core/future-linear-operator
rubenzorrilla Dec 9, 2025
78a5360
Merge branch 'master' into core/future-linear-operator
rubenzorrilla Dec 10, 2025
4dbd1db
Advances (not working)
rubenzorrilla Dec 11, 2025
5c9c6bf
Working version
rubenzorrilla Dec 12, 2025
1cdecbf
Merge branch 'master' into core/future-linear-operator
rubenzorrilla Dec 12, 2025
b7be08d
FCT process c++20 fix
rubenzorrilla Dec 12, 2025
55b6363
Preliminary working version
rubenzorrilla Dec 15, 2025
bd1871b
Advances in the new design (not working yet)
rubenzorrilla Dec 16, 2025
c32a0b6
More advances (still not working)
rubenzorrilla Dec 16, 2025
ee8868d
Fix warning in distributed CSR matrix
rubenzorrilla Dec 18, 2025
0a9376c
Compiling (strategies not working yet)
rubenzorrilla Dec 18, 2025
06dbc96
Merge branch 'master' into core/future-linear-operator
rubenzorrilla Dec 19, 2025
b4ac3f5
Minor fix in strategies (WORKING NEW VERSION)
rubenzorrilla Dec 19, 2025
23e1cbe
Merge branch 'master' into core/future-linear-operator
rubenzorrilla Jan 7, 2026
17873b4
Using std::any
rubenzorrilla Jan 7, 2026
9dfc701
Nice & Clean (working version w/ std::any and linalg defines)
rubenzorrilla Jan 8, 2026
aed78d5
Minors
rubenzorrilla Jan 9, 2026
7d22909
Better name for linear system container
rubenzorrilla Jan 9, 2026
712fdb2
Remove linear operator variadic alternative
rubenzorrilla Jan 9, 2026
77c216f
Fix autorship
rubenzorrilla Jan 9, 2026
de88ab8
Fix autorship
rubenzorrilla Jan 9, 2026
8e51e8a
Revert Python export
rubenzorrilla Jan 9, 2026
39d5e0f
Add linear algebra defines
rubenzorrilla Jan 9, 2026
a020766
Revert no longer needed changes in distributed CSR
rubenzorrilla Jan 9, 2026
3845634
Rename linear operator test file
rubenzorrilla Jan 9, 2026
075bc14
Delete file
rubenzorrilla Jan 9, 2026
94fc666
Test
rubenzorrilla Jan 9, 2026
e4f1d55
Matrix-free and CSR linear operators
rubenzorrilla Jan 9, 2026
7e6f002
Merge branch 'core/future-add-linear-algebra-defines' into core/futur…
rubenzorrilla Jan 9, 2026
f84198f
Replace linear operators
rubenzorrilla Jan 9, 2026
7473cad
Merge branch 'core/future-add-linear-operators' into core/future-line…
rubenzorrilla Jan 9, 2026
44fae39
Minors and Python exposure
rubenzorrilla Jan 9, 2026
48fcd7c
@matekelemen's suggestions
rubenzorrilla Jan 9, 2026
c701383
Merge branch 'core/future-add-linear-operators' into core/future-line…
rubenzorrilla Jan 9, 2026
0b517da
@matekelemen's suggestion
rubenzorrilla Jan 9, 2026
4a94fbb
Merge branch 'core/future-add-linear-algebra-defines' into core/futur…
rubenzorrilla Jan 9, 2026
7aa2d3f
Rename to traits
rubenzorrilla Jan 9, 2026
085c7d7
Merge branch 'core/future-add-linear-operators' into core/future-line…
rubenzorrilla Jan 9, 2026
f8a807d
Minor fixes
rubenzorrilla Jan 9, 2026
dfd0281
Merge branch 'master' into core/future-linear-operator
rubenzorrilla Jan 15, 2026
8ce7781
Preliminary implementation.
rubenzorrilla Jan 15, 2026
58559ca
Advances in the design
rubenzorrilla Jan 19, 2026
7f823fd
Working
rubenzorrilla Jan 21, 2026
f315442
Compiling advances (strategies tests not working yet)
rubenzorrilla Jan 22, 2026
5faa4b2
WORKING VERSION W/ LINEAR SYSTEM
rubenzorrilla Jan 25, 2026
45a05cb
Minor
rubenzorrilla Jan 26, 2026
c76d81b
Move implicit strategy container
rubenzorrilla Jan 26, 2026
0acb62a
Container clean up
rubenzorrilla Jan 26, 2026
4d883f8
Minor
rubenzorrilla Jan 27, 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
49 changes: 49 additions & 0 deletions kratos/future/containers/define_linear_algebra_mpi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// | / |
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Ruben Zorrilla
//

#pragma once

// System includes

// External includes

// Project includes
#include "containers/distributed_csr_matrix.h"
#include "containers/distributed_sparse_graph.h"
#include "containers/distributed_system_vector.h"

namespace Kratos::Future
{

///@addtogroup KratosCore
///@{

///@name Kratos Classes
///@{

struct DistributedLinearAlgebraTraits
{
using DataType = double;

using IndexType = std::size_t;

using MatrixType = DistributedCsrMatrix<DataType, IndexType>;

using VectorType = DistributedSystemVector<DataType, IndexType>;

using SparseGraphType = DistributedSparseGraph<IndexType>;
};

///@}
///@} addtogroup block

} // namespace Kratos::Future
51 changes: 51 additions & 0 deletions kratos/future/containers/define_linear_algebra_serial.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// | / |
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Ruben Zorrilla
//

#pragma once

// System includes

// External includes

// Project includes
#include "containers/csr_matrix.h"
#include "containers/sparse_contiguous_row_graph.h"
#include "containers/system_vector.h"

namespace Kratos::Future
{

///@addtogroup KratosCore
///@{

///@name Kratos Classes
///@{

struct SerialLinearAlgebraTraits
{
using DataType = double;

using IndexType = std::size_t;

using MatrixType = CsrMatrix<DataType, IndexType>;

using VectorType = SystemVector<DataType, IndexType>;

using DenseMatrixType = DenseMatrix<DataType>; //TODO: think about this one (could it be std::vector<VectorType> ?)

using SparseGraphType = SparseContiguousRowGraph<IndexType>;
};

///@}
///@} addtogroup block

} // namespace Kratos::Future
250 changes: 250 additions & 0 deletions kratos/future/containers/eigenvalue_system.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
// | / |
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Ruben Zorrilla
//

#pragma once

// System includes

// External includes

// Project includes
#include "future/linear_operators/linear_operator.h"

namespace Kratos::Future
{

///@addtogroup KratosCore
///@{

///@name Kratos Classes
///@{

template <class TLinearAlgebra>
class EigenvalueSystem final
{
public:

///@name Type Definitions
///@{

/// Pointer definition of EigenvalueSystem
KRATOS_CLASS_POINTER_DEFINITION(EigenvalueSystem);

/// Type of the matrix from the linear algebra traits
using MatrixType = typename TLinearAlgebra::MatrixType;

/// Type of the vector from the linear algebra traits
using VectorType = typename TLinearAlgebra::VectorType;

/// Type of the linear operator from the linear algebra traits
using LinearOperatorType = LinearOperator<TLinearAlgebra>;

/// Type od the dense matrix
using DenseMatrixType = typename TLinearAlgebra::DenseMatrixType;

/// Type of the dense matrix pointer
using DenseMatrixPointerType = Kratos::shared_ptr<DenseMatrixType>;

///@}
///@name Life Cycle
///@{

/// Constructor
EigenvalueSystem()
{
}

/// Constructor with matrix
EigenvalueSystem(
typename MatrixType::Pointer pK,
typename MatrixType::Pointer pM,
typename VectorType::Pointer pEigenvalues,
DenseMatrixPointerType pEigenvectors,
const std::string SystemName = "")
: mpK(pK)
, mpM(pM)
, mpEigenvalues(pEigenvalues)
, mpEigenvectors(pEigenvectors)
, mSystemName(SystemName)
{
}

// /// Copy constructor
// EigenvalueSystem(const EigenvalueSystem& rOther)
// {
// mpLhs = rOther.mpLhs;
// mpRhs = rOther.mpRhs;
// mpLinearOperator = rOther.mpLinearOperator;
// }

// /// Defaulted move constructor
// EigenvalueSystem(EigenvalueSystem&& rOther)
// {
// mpLhs = std::move(rOther.mpLhs);
// mpRhs = std::move(rOther.mpRhs);
// mpLinearOperator = std::move(rOther.mpLinearOperator);
// }

/// Destructor
~EigenvalueSystem() = default;

///@}
///@name Operators
///@{

// /// Copy assignment operator
// EigenvalueSystem& operator=(const EigenvalueSystem& rOther)
// {
// mpLhs = rOther.mpLhs;
// mpRhs = rOther.mpRhs;
// mpLinearOperator = rOther.mpLinearOperator;
// return *this;
// }

// /// Defaulted move assignment operator
// EigenvalueSystem& operator=(EigenvalueSystem&& rOther)
// {
// mpLhs = std::move(rOther.mpLhs);
// mpRhs = std::move(rOther.mpRhs);
// mpLinearOperator = std::move(rOther.mpLinearOperator);
// return *this;
// }

///@}
///@name Operations
///@{


///@}
///@name Access
///@{

/**
* @brief Get a reference to the stiffness matrix.
* @return Reference to the stiffness matrix
*/
MatrixType& GetStiffnessMatrix()
{
KRATOS_ERROR_IF(!mpK) << "Stiffness matrix is not initialized." << std::endl;
return *mpK;
}

/**
* @brief Get a const reference to the stiffness matrix.
* @return Const reference to the stiffness matrix
*/
const MatrixType& GetStiffnessMatrix() const
{
KRATOS_ERROR_IF(!mpK) << "Stiffness matrix is not initialized." << std::endl;
return *mpK;
}

/**
* @brief Get a reference to the mass matrix.
* @return Reference to the mass matrix
*/
MatrixType& GetMassMatrix()
{
KRATOS_ERROR_IF(!mpM) << "Mass matrix is not initialized." << std::endl;
return *mpM;
}

/**
* @brief Get a const reference to the mass matrix.
* @return Const reference to the mass matrix
*/
const MatrixType& GetMassMatrix() const
{
KRATOS_ERROR_IF(!mpM) << "Mass matrix is not initialized." << std::endl;
return *mpM;
}

/**
* @brief Get a reference to the eigenvalues vector.
* @return Reference to the eigenvalues vector
*/
VectorType& GetEigenvalues()
{
KRATOS_ERROR_IF(!mpEigenvalues) << "Eigenvalues vector is not initialized." << std::endl;
return *mpEigenvalues;
}

/**
* @brief Get a const reference to the eigenvalues vector.
* @return Const reference to the eigenvalues vector
*/
const VectorType& GetEigenvalues() const
{
KRATOS_ERROR_IF(!mpEigenvalues) << "Eigenvalues vector is not initialized." << std::endl;
return *mpEigenvalues;
}

/**
* @brief Get a reference to the eigenvectors matrix.
* @return Reference to the eigenvectors matrix
*/
DenseMatrixType& GetEigenvectors()
{
KRATOS_ERROR_IF(!mpEigenvectors) << "Eigenvectors matrix is not initialized." << std::endl;
return *mpEigenvectors;
}

/**
* @brief Get a const reference to the eigenvectors matrix.
* @return Const reference to the eigenvectors matrix
*/
const DenseMatrixType& GetEigenvectors() const
{
KRATOS_ERROR_IF(!mpEigenvectors) << "Eigenvectors matrix is not initialized." << std::endl;
return *mpEigenvectors;
}

///@}
///@name Inquiry
///@{

/**
* @brief Get the name of the linear system.
* @return Name of the linear system
*/
virtual const std::string& Name() const
{
return mSystemName;
}

///@}
private:

///@name Member Variables
///@{

typename MatrixType::Pointer mpK = nullptr;

typename MatrixType::Pointer mpM = nullptr;

typename VectorType::Pointer mpEigenvalues = nullptr;

DenseMatrixPointerType mpEigenvectors = nullptr;

const std::string mSystemName;

///@}
}; // Class EigenvalueSystem

///@}
///@name Input and output
///@{

///@}
///@} addtogroup block

} // namespace Kratos.
Loading