Currently, this is also the simplest way:
Tensor tens;
prm.add_parameter("Tensor", tens);
Take a look at the documentation of the add parameter method.
Patterns::Tools::to_string(tens);
And
Patterns::Tools::to_value
Are also available to simplify what you want to achieve.
Alternatively:
Ooops! The background was too dark :-)
#include
#include
#include
#include
#include
#include
using namespace dealii;
int main() {
// Let's read this tensor from an istringstream. You may read it from
istream in your
// application
std::istringstream is("set Tensor3x3 = 11,
Here is the code that does what I explained. I just switched up step 5 with
a much simpler approach. Note that you can simply make this into a
function/class template so that you could read general tensors, not just
3x3 tensors. I leave that to you :-)
#include
#include
#include
#include
Ahmad,
On Tuesday, April 14, 2020 at 5:39:06 PM UTC+2, Ahmad Shahba wrote:
>
> I don't know if it is the optimal way but I would use the following
> approach
>
>1. Read tensor components as Patterns::List
>2. Use get
>
>