Error in using FESystem usage

31 views
Skip to first unread message

Vinayak Vijay

unread,
May 16, 2023, 10:12:23 AM5/16/23
to deal.II User Group
Hello,

I am trying to initialise FESystem in a class called "Network" (definition present in a header file), however when i am getting the following error:

In constructor ‘Network::Network(const string&)’:
/home/Network.cpp:21:57: error: use of deleted function ‘dealii::FESystem<dim, spacedim>::FESystem() [with int dim = 1; int spacedim = 3]’
   21 | Network::Network(const std::string &parameter_file)
      |                                                         ^
In file included from /home/Network.h:16,
                 from /home/Network.cpp:1:
/home/user/spack/opt/spack/linux-ubuntu20.04-icelake/gcc-9.4.0/dealii-9.4.2-4haiezd5dty7b537inhxmeebwxllx4gs/include/deal.II/fe/fe_system.h:215:3: note: declared here
  215 |   FESystem() = delete;

I am not able to figure out the error. Can someone help?

Thanks
Vinayak

Lucas Myers

unread,
May 16, 2023, 10:26:31 AM5/16/23
to dea...@googlegroups.com
Hi Vinayak,

If you do not manually initialize member variables in a constructor, they are automatically initialized with their default constructor (i.e. one which takes no arguments). However, the FESystem class is such that the default constructor is manually deleted, and so can't be constructed without explicitly passing in some arguments. In order to get your code to compile, you'll need to call a non-default constructor for your FESystem member variable in the constructor of Network. 

See the FESystem documentation or step-8 (https://www.dealii.org/current/doxygen/deal.II/step_8.html#ElasticProblemElasticProblemconstructor) for an example of how to properly construct an FESystem object. 


--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/de162421-9d6d-4722-a3e6-6c92fa316319n%40googlegroups.com.

Daniel Arndt

unread,
May 16, 2023, 12:14:34 PM5/16/23
to dea...@googlegroups.com
Vinayak,

an alternative to initializing an object of type FESystem in the constructor is to use a smart pointer like

std::unique_ptr<FESystem<dim, spacedim>> fe_system_ptr;

as a member variable since that one would have a default constructor.

Best,
Daniel

Vinayak Vijay

unread,
May 16, 2023, 3:31:52 PM5/16/23
to deal.II User Group
Thank you for your response. I was able to fix it.
Reply all
Reply to author
Forward
0 new messages