Hi Wolfgang,
Below is the interface for copy_to:
template<typename number >
template<int dim>
void FullMatrix< number >::copy_to ( Tensor< 2, dim > & T,
const size_type src_r_i = 0,
const size_type src_r_j = dim - 1,
const size_type src_c_i = 0,
const size_type src_c_j = dim - 1,
const unsigned int dst_r = 0,
const unsigned int dst_c = 0
) const
When I called the function, I just used the default values for variables 2
to 7.
I actually compared the header file "include/deal.II/lac/full_matrix.h". In
the develop branch (9.5.0), the definition of copy_to is implemented in the
header file. However, in 9.4.0, the header file only has the declaration of
copy_to. The actual implementation happens in "/dealii-9.4.0/src/source/lac/
full_matrix.inst.in"
*for (S : REAL_SCALARS) { template void
FullMatrix<S>::copy_to<1>(Tensor<2, 1> &,
const size_type, const
size_type, const size_type,
const size_type,
const unsigned int,
const unsigned int) const; template void
FullMatrix<S>::copy_to<2>(Tensor<2, 2> &,
const size_type, const
size_type, const size_type,
const size_type,
const unsigned int,
const unsigned int) const; template void
FullMatrix<S>::copy_to<3>(Tensor<2, 3> &,
const size_type, const
size_type, const size_type,
const size_type,
const unsigned int,
const unsigned int) const; }*
This probably explains why the function works properly in 9.5.0 but does
not work in 9.4.0 for dimensions larger than 3.
Anyhow, I think 9.5.0 has fixed this issue already.
Best,
Tao
On Thursday, June 8, 2023 at 7:36:03 PM UTC-4 Wolfgang Bangerth wrote:
>
> Tao:
>
> On 6/7/23 12:45, Tao Jin wrote:
> > *** Caution: EXTERNAL Sender ***
> >
> > Dear Wolfgang,
> >
> > Here is a simple test code (I also attached the source code):
> >
> > int main()
> > {
> > using namespace dealii;
> >
> > const unsigned int *matrix_dimension* = 4;
> >
> > Tensor<2, matrix_dimension> myTensor;
> >
> > FullMatrix<double> myMatrix(matrix_dimension,
> > matrix_dimension);
> >
> > for (unsigned int i = 0; i < matrix_dimension; i++)
> > for (unsigned int j = 0; j < matrix_dimension; j++)
> > {
> > myMatrix(i,j) = i + j;
> > }
> >
> > myMatrix.copy_to(myTensor);
> >
> > std::cout << myTensor.dimension << std::endl;
> >
> > return 0;
> > }
> >
> > When *matrix_dimension =*2 or 3, the code works fine. When
> *matrix_dimension
> > *= 4, it has a linking error as below:
> > /error: undefined reference to 'void
> > dealii::FullMatrix<double>::copy_to<4>(dealii::Tensor<2, 4, double>&,
> unsigned
> > long, unsigned long, unsigned long, unsigned long, unsigned int,
> unsigned int)
> > const'
> > collect2: error: ld returned 1 exit status
> > make[3]: *** [CMakeFiles/main.dir/build.make:116: main] Error 1/
> >
> > The version of deal.ii is 9.4.0.
>
> I tried this out with the current development version (which will become
> 9.5
> within the next few weeks) and it works just fine:
> https://github.com/dealii/dealii/pull/15331
>
> I am not sure what is going on here. In your code snippet, you call the
> copy_to() function with one argument, but the error message refers to the
> function with 7 arguments. Are you sure that this is the code you wanted
> to use?
>
> Best
> W.
>
> --
> ------------------------------------------------------------------------
> Wolfgang Bangerth email: [email protected]
> www: http://www.math.colostate.edu/~bangerth/
>
>
>
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/13481bb3-f449-4972-bb5e-9803460487b9n%40googlegroups.com.