mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add col/row access methods for Tensor2D (#1430)
This commit is contained in:
committed by
Andrew Heather
parent
61dfa9b544
commit
79dff5d8fe
@ -40,7 +40,7 @@ int main()
|
||||
Info<< "tensor " << t3 << nl;
|
||||
|
||||
t3.row<2>(Zero);
|
||||
Info<< "replaced row<1> = " << t3.row<2>() << nl;
|
||||
Info<< "replaced row<2> = " << t3.row<2>() << nl;
|
||||
Info<< "tensor " << t3 << nl;
|
||||
|
||||
triad tr3(t3);
|
||||
|
||||
@ -6,9 +6,37 @@ using namespace Foam;
|
||||
int main()
|
||||
{
|
||||
vector2D v1(1, 2), v2(3, 4);
|
||||
tensor2D t = v1*v2;
|
||||
tensor2D t3 = v1*v2;
|
||||
|
||||
Info<< "v1(1, 2)*v2(3, 4) = " << t << endl;
|
||||
Info<< v1 << "*" << v2 << " = " << t3 << endl;
|
||||
|
||||
{
|
||||
Info<< "rows:" << nl;
|
||||
for (direction i=0; i < 2; ++i)
|
||||
{
|
||||
Info<< " (" << i << ") = " << t3.row(i) << nl;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Info<< "cols:" << nl;
|
||||
for (direction i=0; i < 2; ++i)
|
||||
{
|
||||
Info<< " (" << i << ") = " << t3.col(i) << nl;
|
||||
}
|
||||
Info<< "col<0> = " << t3.col<0>() << nl;
|
||||
Info<< "col<1> = " << t3.col<1>() << nl;
|
||||
// Compilation error: Info << "col<3> = " << t3.col<3>() << nl;
|
||||
|
||||
t3.col<0>({0, 2});
|
||||
Info<< "replaced col<0> = " << t3.col<0>() << nl;
|
||||
Info<< "tensor " << t3 << nl;
|
||||
|
||||
t3.row<1>(Zero);
|
||||
Info<< "replaced row<1> = " << t3.row<1>() << nl;
|
||||
Info<< "tensor " << t3 << nl;
|
||||
}
|
||||
Info<< nl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user