Re: [deal.II] Tensor<1, dim> initialization

2020-01-06 Thread Wolfgang Bangerth
On 1/5/20 6:15 AM, A.Z Ihsan wrote: > just a small question. > > suppose we want to construct a rank-1 tensor in 3 dim with values (1, 1, 0) : > Tensor<1, 3> b(); In addition the other answer, you can also initialize the tensor like this: Tensor<1,3> t2({1., 1., 0.}); or Tensor<1,3> t4{{1.,

Re: [deal.II] Tensor<1, dim> initialization

2020-01-05 Thread A.Z Ihsan
Thank you Matthias. It works perfectly! BR, Ihsan On Sunday, January 5, 2020 at 3:41:38 PM UTC+1, Matthias Maier wrote: > > > On Sun, Jan 5, 2020, at 07:15 CST, "A.Z Ihsan" > wrote: > > > Tensor<1, 3> b(); > > If you write this then you declare a function "b" returning a > Tensor<1,3>. Dec

Re: [deal.II] Tensor<1, dim> initialization

2020-01-05 Thread Matthias Maier
On Sun, Jan 5, 2020, at 07:15 CST, "A.Z Ihsan" wrote: > Tensor<1, 3> b(); If you write this then you declare a function "b" returning a Tensor<1,3>. Declare the tensor without the parentheses: Tensor<1, 3> b; You can access individual elements of the tensor via operator[]: b[0] = 1;

[deal.II] Tensor<1, dim> initialization

2020-01-05 Thread A.Z Ihsan
Hi there, just a small question. suppose we want to construct a rank-1 tensor in 3 dim with values (1, 1, 0) : Tensor<1, 3> b(); i read a documentation we can use array_type as a parameter construction, but still i aml confused how to use it. any idea how to use it? BR, Ihsan -- The dea