G+Smo  25.01.0
Geometry + Simulation Modules
 
Loading...
Searching...
No Matches
gsFlowTerms.hpp
Go to the documentation of this file.
1
12#pragma once
14
15namespace gismo
16{
17
18template<class T>
20{
21 evalCoeff(mapData);
22
23 index_t npts = mapData.points.cols();
24 gsVector<T> result(npts);
25
26 for (index_t k = 0; k < npts; k++)
27 {
28 index_t coeffID = (m_coeff.size() == 1) ? 0 : k;
29 result(k) = m_coeff(coeffID) * mapData.measure(k);
30 }
31
32 return result;
33}
34
35
36template<class T>
37void gsFlowTerm_ValVal<T>::assemble(const gsMapData<T>& mapData, const gsVector<T>& quWeights, const std::vector< gsMatrix<T> >& testFunData, const std::vector< gsMatrix<T> >& shapeFunData, gsMatrix<T>& localMat)
38{
39 gsVector<T> coeffMeasure = this->getCoeffGeoMapProduct(mapData);
40
41 const gsMatrix<T>& testFunVals = testFunData[0];
42 const gsMatrix<T>& shapeFunVals = shapeFunData[0];
43
44 const index_t nQuPoints = quWeights.rows();
45
46 for (index_t k = 0; k < nQuPoints; k++)
47 {
48 const T weight = quWeights(k) * coeffMeasure(k);
49 localMat.noalias() += weight * (testFunVals.col(k) * shapeFunVals.col(k).transpose());
50 }
51}
52
53// ===================================================================================================================
54
55template<class T>
56void gsFlowTerm_GradGrad<T>::assemble(const gsMapData<T>& mapData, const gsVector<T>& quWeights, const std::vector< gsMatrix<T> >& testFunData, const std::vector< gsMatrix<T> >& shapeFunData, gsMatrix<T>& localMat)
57{
58 gsVector<T> coeffMeasure = this->getCoeffGeoMapProduct(mapData);
59
60 const gsMatrix<T>& testFunGrads = testFunData[1];
61 const gsMatrix<T>& shapeFunGrads = shapeFunData[1];
62
63 const index_t nQuPoints = quWeights.rows();
64 gsMatrix<T> testFunPhysGrad, shapeFunPhysGrad;
65
66 for (index_t k = 0; k < nQuPoints; k++)
67 {
68 const T weight = quWeights(k) * coeffMeasure(k);
69
70 transformGradients(mapData, k, testFunGrads, testFunPhysGrad);
71 transformGradients(mapData, k, shapeFunGrads, shapeFunPhysGrad);
72
73 localMat.noalias() += weight * (testFunPhysGrad.transpose() * shapeFunPhysGrad);
74 }
75}
76
77// ===================================================================================================================
78
79template<class T>
80void gsFlowTerm_rhs<T>::assemble(const gsMapData<T>& mapData, const gsVector<T>& quWeights, const std::vector< gsMatrix<T> >& testFunData, const std::vector< gsMatrix<T> >& shapeFunData, gsMatrix<T>& localMat)
81{
82 m_pRhsFun->eval_into(mapData.values[0], m_rhsVals);
83
84 const index_t nQuPoints = quWeights.rows();
85
86 for (index_t k = 0; k < nQuPoints; k++)
87 {
88 const T weight = quWeights(k) * mapData.measure(k);
89
90 localMat.noalias() += weight * (testFunData[0].col(k) * m_rhsVals.col(k).transpose());
91 }
92}
93
94
95} // namespace gismo
virtual void assemble(const gsMapData< T > &mapData, const gsVector< T > &quWeights, const std::vector< gsMatrix< T > > &testFunData, const std::vector< gsMatrix< T > > &shapeFunData, gsMatrix< T > &localMat)
Assemble the current local matrix.
Definition gsFlowTerms.hpp:56
virtual void assemble(const gsMapData< T > &mapData, const gsVector< T > &quWeights, const std::vector< gsMatrix< T > > &testFunData, const std::vector< gsMatrix< T > > &shapeFunData, gsMatrix< T > &localMat)
Assemble the current local matrix.
Definition gsFlowTerms.hpp:37
virtual void assemble(const gsMapData< T > &mapData, const gsVector< T > &quWeights, const std::vector< gsMatrix< T > > &testFunData, const std::vector< gsMatrix< T > > &shapeFunData, gsMatrix< T > &localMat)
Assemble the current local matrix.
Definition gsFlowTerms.hpp:80
A class computing individual terms of the weak formulation appearing in incompressible flow problems.
Definition gsFlowTerms.h:22
the gsMapData is a cache of pre-computed function (map) values.
Definition gsFuncData.h:349
gsMatrix< T > points
input (parametric) points
Definition gsFuncData.h:372
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
A vector with arbitrary coefficient type and fixed or dynamic size.
Definition gsVector.h:37
#define index_t
Definition gsConfig.h:32
The G+Smo namespace, containing all definitions for the library.