Re: [deal.II] Re: Problem about modifying CMakeList.txt to add library

2020-12-29 Thread Wolfgang Bangerth



My question is, I want to use the eigenvalue problem solving capability of 
armadillo in my code. However, my matrix type is of BlockSparseMatrix in 
dealii. How do I go about using my BlockSparseMatrix with the available 
armadillo functions that use sp_mat type matrices 
? 
One idea that I thought was to print my block_sparse_matrix using the function 
block_write() 
 
that prints the dealii Sparse_matrix in a binary format. However, I am not 
able to read that file using armadillo's functionality to load binary files 
.


Just write a function that copies the data from one object to another. You can 
iterate over deal.II matrix entries, and then you just need to figure out how 
Armadillo wants its matrices filled.


Best
 W.

--

Wolfgang Bangerth  email: bange...@colostate.edu
   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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/3b64f36b-70fc-762d-e9c2-e5e3c6f28208%40colostate.edu.


[deal.II] Re: Problem about modifying CMakeList.txt to add library

2020-12-24 Thread Animesh Rastogi IIT Gandhinagar
Hi Daniel,

I was able to sort this issue out. What I did was removed everything 
related to armadillo in the cmakelists.txt and just linked armadillo to my 
target using  the following line in the end of the file 
TARGET_LINK_LIBRARIES(${TARGET} armadillo)
I am able to run small programs using armadillo within dealii.

I have another question which might not be in the scope of this forum. 
However, since you and Jean have worked with armadillo (by looking at the 
Ceres code gallery program), I was wondering if any of you can help. 

My question is, I want to use the eigenvalue problem solving capability of 
armadillo in my code. However, my matrix type is of BlockSparseMatrix in 
dealii. How do I go about using my BlockSparseMatrix with the available 
armadillo functions that use sp_mat type matrices 
? One idea that I thought was 
to print my block_sparse_matrix using the function block_write() 

 
that prints the dealii Sparse_matrix in a binary format. However, I am not 
able to read that file using armadillo's functionality to load binary files 
.

Thanks!

Animesh

On Wednesday, December 23, 2020 at 2:22:38 PM UTC+5:30 Animesh Rastogi IIT 
Gandhinagar wrote:

> Hi Daniel, 
>
> I also want to use armadillo for one of my projects. I did exactly as you 
> suggested in the link above. The cmake worked perfectly. However, on doing 
> make run, I am getting the following error. I installed armadillo using the 
> apt-get package manager - command was - *sudo apt-get install 
> libarmadillo-dev*
>
> Error:
>
> /usr/bin/ld.gold: error: /usr/include/armadillo:1:4: syntax error, 
> unexpected STRING
> /usr/bin/ld.gold: error: /usr/include/armadillo: not an object or archive
> collect2: error: ld returned 1 exit status
> CMakeFiles/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis.dir/build.make:122:
>  
> recipe for target 'Quasi_Static_Finite_Strain_Beam_Buckling_Analysis' failed
> make[3]: *** [Quasi_Static_Finite_Strain_Beam_Buckling_Analysis] Error 1
> CMakeFiles/Makefile2:163: recipe for target 
> 'CMakeFiles/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis.dir/all' 
> failed
> make[2]: *** 
> [CMakeFiles/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis.dir/all] 
> Error 2
> CMakeFiles/Makefile2:138: recipe for target 'CMakeFiles/run.dir/rule' 
> failed
> make[1]: *** [CMakeFiles/run.dir/rule] Error 2
> Makefile:144: recipe for target 'run' failed
> make: *** [run] Error 2
>
> I was wondering if you can help me with this issue!
>
> Thanks a lot!
>
> Animesh
>
> On Thursday, May 17, 2018 at 3:17:11 AM UTC+5:30 Daniel Arndt wrote:
>
>> Pal,
>>
>> We also just updated the CMakeLists.txt file for an example in our 
>> code-gallery that uses armadillo.
>> You might want to look at 
>> https://github.com/dealii/code-gallery/blob/master/CeresFE/CMakeLists.txt
>> .
>>
>> Best,
>> Daniel
>>
>

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/87d9b5dd-a635-4f6a-9c24-a39b6f0f0a2en%40googlegroups.com.


[deal.II] Re: Problem about modifying CMakeList.txt to add library

2020-12-23 Thread Animesh Rastogi IIT Gandhinagar
Hi Daniel, 

I also want to use armadillo for one of my projects. I did exactly as you 
suggested in the link above. The cmake worked perfectly. However, on doing 
make run, I am getting the following error. I installed armadillo using the 
apt-get package manager - command was - *sudo apt-get install 
libarmadillo-dev*

Error:

/usr/bin/ld.gold: error: /usr/include/armadillo:1:4: syntax error, 
unexpected STRING
/usr/bin/ld.gold: error: /usr/include/armadillo: not an object or archive
collect2: error: ld returned 1 exit status
CMakeFiles/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis.dir/build.make:122:
 
recipe for target 'Quasi_Static_Finite_Strain_Beam_Buckling_Analysis' failed
make[3]: *** [Quasi_Static_Finite_Strain_Beam_Buckling_Analysis] Error 1
CMakeFiles/Makefile2:163: recipe for target 
'CMakeFiles/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis.dir/all' 
failed
make[2]: *** 
[CMakeFiles/Quasi_Static_Finite_Strain_Beam_Buckling_Analysis.dir/all] 
Error 2
CMakeFiles/Makefile2:138: recipe for target 'CMakeFiles/run.dir/rule' failed
make[1]: *** [CMakeFiles/run.dir/rule] Error 2
Makefile:144: recipe for target 'run' failed
make: *** [run] Error 2

I was wondering if you can help me with this issue!

Thanks a lot!

Animesh

On Thursday, May 17, 2018 at 3:17:11 AM UTC+5:30 Daniel Arndt wrote:

> Pal,
>
> We also just updated the CMakeLists.txt file for an example in our 
> code-gallery that uses armadillo.
> You might want to look at 
> https://github.com/dealii/code-gallery/blob/master/CeresFE/CMakeLists.txt.
>
> Best,
> Daniel
>

-- 
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 dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/a1545c39-e2e5-41e4-b92f-d5462ff9b1bdn%40googlegroups.com.


[deal.II] Re: Problem about modifying CMakeList.txt to add library

2018-05-16 Thread Pai Liu
Dear David Wells,

Thank you for your reply! Your explanation helps me to understand this 
process better. Yestoday I tried to use "FIND_PACKAGE" as following and it 
works:

_

FIND_PACKAGE(Armadillo)

INCLUDE_DIRECTORIES(${ARMADILLO_INCLUDE_DIRS})

ADD_EXECUTABLE(${TARGET} ${TARGET_SRC})
DEAL_II_SETUP_TARGET(${TARGET})

TARGET_LINK_LIBRARIES(${TARGET} ${ARMADILLO_LIBRARIES})

_


I will try the commends you recommended later! Thank you very much!

Best,
Pai


On Thursday, May 17, 2018 at 1:53:36 AM UTC+8, David Wells wrote:
>
> Hi Pai,
>
> I think that there is an easier way to do this. More exactly: armadillo 
> should not be a target since we don't have to compile anything: we should 
> just be able to specify the library we need to link against and (possibly) 
> a path to the headers and be done.
>
> Have you installed armadillo in a standard location? If so then you should 
> be able to just append
>
> TARGET_LINK_LIBRARIES(${TARGET} armadillo)
>
> to the end of CMakeLists.txt (after the call to PROJECT and 
> DEAL_II_INVOKE_AUTOPILOT)
>
> and things should work correctly.
>
> Thanks,
> David Wells
>
> P.S. the CMake module for setting up armadillo looks for a lot of things 
> that don't exist on my computer; I recommend avoiding using FIND_PACKAGE.
>
> On Wednesday, May 16, 2018 at 2:54:39 AM UTC-4, Pai Liu wrote:
>>
>> Hi all,
>>
>> I am learning Step-8 in the tutorial. I want to use the library 
>> "Armadillo" (which is a library for scientific computing and linear 
>> algebra) together with dealii in step-8.cc.
>> To compile a cpp file that only depends on the Armadillo library, one 
>> needs to excute the following commends at the commend line : "g++ 
>> example.cpp -o example -O2 -larmadillo"
>> So I replace "mylib" in dealii documentation about modifying 
>> cmakelist.txt with "armadillo", and modify the CMakeList.txt file as the 
>> following
>>
>> _
>> CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
>>
>> FIND_PACKAGE(deal.II 8.5.0 REQUIRED
>>   HINTS ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
>>   )
>> DEAL_II_INITIALIZE_CACHED_VARIABLES()
>>
>> PROJECT(myproject)
>>
>> ADD_LIBRARY(armadillo)
>> DEAL_II_SETUP_TARGET(armadillo)
>>
>> ADD_EXECUTABLE(mycode step-8.cc)
>> DEAL_II_SETUP_TARGET(mycode)
>>
>> TARGET_LINK_LIBRARIES(mycode armadillo)
>> _
>>
>> And I got the the following error:
>>
>> -- Using the deal.II-8.5.1 installation found at 
>> /home/liu/deal.ii-candi/deal.II-v8.5.1
>> -- Include macro 
>> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_initialize_cached_variables.cmake
>> -- Include macro 
>> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_setup_target.cmake
>> -- Include macro 
>> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_query_git_information.cmake
>> -- Include macro 
>> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_pickup_tests.cmake
>> -- Include macro 
>> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_add_test.cmake
>> -- Include macro 
>> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_invoke_autopilot.cmake
>> You have called ADD_LIBRARY for library armadillo without any source 
>> files. This typically indicates a problem with your CMakeLists.txt file
>> -- Configuring done
>> CMake Error: Cannot determine link language for target "armadillo".
>> CMake Error: CMake can not determine linker language for target: armadillo
>> -- Generating done
>> -- Build files have been written to: /home/liu/P/homogenization
>>
>>
>>
>>
>>
>> Can anyone help me about this issue about add library?
>> Many thanks in advance!
>>  
>>
>

-- 
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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: Problem about modifying CMakeList.txt to add library

2018-05-16 Thread Pai Liu
Dear Daniel Arndt,

Thank you for your reply! The link is very helpful! Now my CMakeList.txt 
works!

Best,
Pai 

On Thursday, May 17, 2018 at 5:47:11 AM UTC+8, Daniel Arndt wrote:
>
> Pal,
>
> We also just updated the CMakeLists.txt file for an example in our 
> code-gallery that uses armadillo.
> You might want to look at 
> https://github.com/dealii/code-gallery/blob/master/CeresFE/CMakeLists.txt.
>
> Best,
> Daniel
>

-- 
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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: Problem about modifying CMakeList.txt to add library

2018-05-16 Thread Daniel Arndt
Pal,

We also just updated the CMakeLists.txt file for an example in our 
code-gallery that uses armadillo.
You might want to look at 
https://github.com/dealii/code-gallery/blob/master/CeresFE/CMakeLists.txt.

Best,
Daniel

-- 
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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: Problem about modifying CMakeList.txt to add library

2018-05-16 Thread David Wells
Hi Pai,

I think that there is an easier way to do this. More exactly: armadillo 
should not be a target since we don't have to compile anything: we should 
just be able to specify the library we need to link against and (possibly) 
a path to the headers and be done.

Have you installed armadillo in a standard location? If so then you should 
be able to just append

TARGET_LINK_LIBRARIES(${TARGET} armadillo)

to the end of CMakeLists.txt (after the call to PROJECT and 
DEAL_II_INVOKE_AUTOPILOT)

and things should work correctly.

Thanks,
David Wells

P.S. the CMake module for setting up armadillo looks for a lot of things 
that don't exist on my computer; I recommend avoiding using FIND_PACKAGE.

On Wednesday, May 16, 2018 at 2:54:39 AM UTC-4, Pai Liu wrote:
>
> Hi all,
>
> I am learning Step-8 in the tutorial. I want to use the library 
> "Armadillo" (which is a library for scientific computing and linear 
> algebra) together with dealii in step-8.cc.
> To compile a cpp file that only depends on the Armadillo library, one 
> needs to excute the following commends at the commend line : "g++ 
> example.cpp -o example -O2 -larmadillo"
> So I replace "mylib" in dealii documentation about modifying 
> cmakelist.txt with "armadillo", and modify the CMakeList.txt file as the 
> following
>
> _
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
>
> FIND_PACKAGE(deal.II 8.5.0 REQUIRED
>   HINTS ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
>   )
> DEAL_II_INITIALIZE_CACHED_VARIABLES()
>
> PROJECT(myproject)
>
> ADD_LIBRARY(armadillo)
> DEAL_II_SETUP_TARGET(armadillo)
>
> ADD_EXECUTABLE(mycode step-8.cc)
> DEAL_II_SETUP_TARGET(mycode)
>
> TARGET_LINK_LIBRARIES(mycode armadillo)
> _
>
> And I got the the following error:
>
> -- Using the deal.II-8.5.1 installation found at 
> /home/liu/deal.ii-candi/deal.II-v8.5.1
> -- Include macro 
> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_initialize_cached_variables.cmake
> -- Include macro 
> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_setup_target.cmake
> -- Include macro 
> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_query_git_information.cmake
> -- Include macro 
> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_pickup_tests.cmake
> -- Include macro 
> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_add_test.cmake
> -- Include macro 
> /home/liu/deal.ii-candi/deal.II-v8.5.1/share/deal.II/macros/macro_deal_ii_invoke_autopilot.cmake
> You have called ADD_LIBRARY for library armadillo without any source 
> files. This typically indicates a problem with your CMakeLists.txt file
> -- Configuring done
> CMake Error: Cannot determine link language for target "armadillo".
> CMake Error: CMake can not determine linker language for target: armadillo
> -- Generating done
> -- Build files have been written to: /home/liu/P/homogenization
>
>
>
>
>
> Can anyone help me about this issue about add library?
> Many thanks in advance!
>  
>

-- 
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 dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.