BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
fn_ddot.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef BELFEM_FN_DDOT_HPP
13#define BELFEM_FN_DDOT_HPP
14
15#include "assert.hpp"
16#include "fn_TR_contract44.hpp"
17#include "cl_Matrix.hpp"
18#include "cl_Tensor.hpp"
19
20namespace belfem
21{
22//----------------------------------------------------------------------------
23
24 template < typename T >
25 inline void
26 ddot( const Tensor< T > & aA, const Tensor< T > & aB, Tensor< T > & aC )
27 {
28 BELFEM_ASSERT( aA.is_3333(), "Tensor A must be of type 3x3x3x3" );
29 BELFEM_ASSERT( aB.is_3333(), "Tensor B must be of type 3x3x3x3" );
30 BELFEM_ASSERT( aC.is_3333(), "Tensor C must be of type 3x3x3x3" );
31
32 tensor::contract44( aA.data(), aB.data(), aC.data() );
33 }
34
35//----------------------------------------------------------------------------
36
37 template < typename T >
38 inline void
39 ddot( const Tensor< T > & aA, const Matrix< T > & aB, Matrix< T > & aC )
40 {
41 BELFEM_ASSERT( aA.is_3333(), "Tensor A must be of type 3x3x3x3" );
42 BELFEM_ASSERT( aB.n_rows() == 3 && aB.n_cols() == 3,
43 "Matrix B must be of size 3x3" );
44 BELFEM_ASSERT( aC.n_rows() == 3 && aC.n_cols() == 3,
45 "Matrix C must be of size 3x3" );
46
47 // canonical mixed signature ( tensor data pointer, matrix refs ) —
48 // the only form both backends provide; under Blaze the matrices are
49 // padded, so raw matrix pointers must not be used
50 tensor::contract42( aA.data(), aB, aC );
51 }
52
53//----------------------------------------------------------------------------
54}
55#endif //BELFEM_FN_DDOT_HPP
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
Dense column-major matrix.
Definition cl_BZ_Matrix.hpp:28
size_t n_rows() const
Definition cl_AR_Matrix.hpp:205
size_t n_cols() const
Definition cl_AR_Matrix.hpp:213
Third- or fourth-order tensor container; the constitutive helpers (contraction, rotation,...
Definition cl_Tensor.hpp:43
T * data()
expose the underlying raw pointer
Definition cl_Tensor.hpp:211
bool is_3333() const
returns true if this is a 3x3x3x3 tensor
Definition cl_Tensor.hpp:319
void contract42(const T *A, const T *B, T *C)
tensor contraction A_ijkl * B_kl = C_ij
Definition fn_TR_contract42_arma.hpp:28
void contract44(const T *A, const T *B, T *C)
tensor contraction A_ijmn * B_mnkl = C_ijkl
Definition fn_TR_contract44.hpp:26
USER GUIDES:
Definition cl_Capacitor.cpp:16
void ddot(const Tensor< T > &aA, const Tensor< T > &aB, Tensor< T > &aC)
Definition fn_ddot.hpp:26