Re: [deal.II] How to apply a spatially variable non-zero initial condition in step-52?

2020-06-08 Thread Wolfgang Bangerth



Krishna,

I tried using the VectorTools::project idea from step-25. However, my code 
fails to compile, and I could not decipher the errors and do not know how to 
fix this problem (have been stuck for a while).


The attached code tries to implement Step-52 (but for 1D), with homogenous 
dirichelet BC  at the left edge and homogenous Neumann BC at the right edge, 
with an initial value of 4/5*x*(1 - x/5) (a simple quadratic function). I am 
also attaching the CMakeLists.txt (adapted from Step-52 suitably).


I'd appreciate help (from you and others here on the forum) to solve this issue.


You really need to learn how to read error messages because this is really a 
rather simple case. The error you get is this:


/home/bangerth/p/deal.II/1/install/examples/step-1/step-1.cc:362:26: error: 
‘Step52::InitialValues’ is not a template

  InitialValues<1>(1, time),
  ^
/home/bangerth/p/deal.II/1/install/examples/step-1/step-1.cc:362:50: error: no 
matching function for call to ‘Step52::InitialValues::InitialValues(int, 
time_t (&)(time_t*) throw ())’

  InitialValues<1>(1, time),
  ^

So you already know exactly what the line in question may be. There aren't all 
that many possibilities for what could be wrong. The issue in your case is 
that the 'time' variable doesn't exist in the function where you have the code 
in question. The obscurity of the actual error message comes from the fact 
that there is a global time() function. But in the end, this is a case where 
you could have found the solution yourself.


So just replace time->0 if you want the initial values and everything should 
work.

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/86f05575-28b3-80f3-cfa2-4dc89247f923%40colostate.edu.


[deal.II] Re: Broadcasting packed objects

2020-06-08 Thread 'peterrum' via deal.II User Group
What you could also do is to turn compression off.

Peter

On Monday, 8 June 2020 14:19:25 UTC+2, peterrum wrote:
>
> Dear Maurice,
>
> The problem is that the size of `auto buffer = 
> dealii::Utilities::pack(r1);` is not the same on all processes, which is a 
> requirement if you use `MPI_Bcast`. My suggestion would to split the 
> procedure into two steps: 1) bcast the size on rank 1; 2) bcast the actual 
> data.
>
> Peter
>
> On Monday, 8 June 2020 12:46:53 UTC+2, Maurice Rohracker wrote:
>>
>> Dear deal.II community,
>>
>> For a distributed implementation, we would like to broadcast packed data 
>> objects.
>>
>> For the beginning, we would like to understand how the serialize function 
>> for packing an object is working in the sense of the deal.II way, before it 
>> is getting more complicated.
>>
>> I created a small test with a class, which should be broadcasted. As a 
>> comparison, I took the dealii:Point, which can obviously be packed and 
>> broadcasted without any issues.
>>
>> Unfortunately, the broadcast for our class does not work. We assume that 
>> our serialize function is not in the correct manner. Is it possible to pack 
>> own objects using the dealii::Utilities:pack() function? What is the proper 
>> way defining the serialize function?
>>
>> Attached you'll find our small example code. We are using deal.II 9.0.1.
>>
>> Thank you very much in advance.
>>
>> Best regards,
>> Maurice Rohracker
>> Master Student Computational Engineering
>> FAU Erlange-Nürnberg
>>
>

-- 
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/fce1fbdf-6a12-4700-82de-d6aaf0d084e4o%40googlegroups.com.


Re: [deal.II] Strategy to snap the boundary of a triangulation to a manifold

2020-06-08 Thread Wolfgang Bangerth

On 6/8/20 10:22 AM, Bruno Blais wrote:



Would any of you have a suggestion on how best to achieve the deformation of 
the nodes to match the manifold?


I suspect that this depends a lot on how exactly your manifold is given. You 
need some projection onto the manifold. If you used IGES CAD files, such 
projections are built-in with OpenCASCADE. For constructive solid geometry 
cases, it may be possible to build the project from known normal vectors. I 
expect that the situation becomes complicated in the "creases" where two 
boundary patches come together.


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/c2693a9d-ac2e-a18e-f629-11f7a89217dc%40colostate.edu.


Re: [deal.II] Step-4 1D problem

2020-06-08 Thread 'Christoph Kammer' via deal.II User Group

Hi Peter,

I've never used this functionality of git but I think I just posted a 
pull-request describing this minor issue.


Wouldn't it be easier to change the documentation on the tutorials 
website or is that done through Git, too?


PS. My experience with Git is rather limited although I should probably 
adopt a habit of using it more so maybe this is the time.



Best,


Christoph



On 6/8/20 12:00 PM, 'peterrum' via deal.II User Group wrote:

Indeed! Christoph, you seem to be right!

Feel free to create a pull request on GitHub for this inconsistency! 
We will help you if you need some assistance! Amazing that there are 
still errors in the first tutorials although - probably - all deal.II 
user have had a look at these...


Thanks,
Peter

On Monday, 8 June 2020 17:50:25 UTC+2, Christoph Kammer wrote:

Thank you Praveen,

that solved my problem. After fixing the issue with the boundary
id things made sense. Is there a particular reason that in 1D the
boundary points are labeled in a different manner than in 2+ D?

PS. deal ii team. In the documentation on step 3 + 4 it states
that the Poisson problem is solved on a domain [0,1]^dim. The
actual solver however is implemented to solve this problem on the
domain [-1,1]^dim. Perhaps the introduction to this tutorial
should be made consistent with the commented program.


Thanks again,


Christoph


On 6/7/20 1:14 AM, Praveen C wrote:

In 1-D,

GridGenerator::hyper_cube(triangulation, -1, 1);

will assign different boundary indicators to left and right side,
even though colorize=false is default, see


https://dealii.org/developer/doxygen/deal.II/namespaceGridGenerator.html#acea0cbcd68e52ce8113d1134b87de403



 I think left=0 and right=1. Due to this reason, bc may not be
applied on both sides.

Do the apply bc twice, once with indicator=0 and once with
indicator=1.

  std::map boundary_values;
VectorTools::interpolate_boundary_values(dof_handler,
0, // left boundary
BoundaryValues(),
boundary_values);
MatrixTools::apply_boundary_values(boundary_values,
                                  system_matrix,
                                  solution,
                                  system_rhs);

VectorTools::interpolate_boundary_values(dof_handler,
1, // right boundary
BoundaryValues(),
boundary_values);
MatrixTools::apply_boundary_values(boundary_values,
system_matrix,
                                  solution,
                                  system_rhs);

Best
praveen


On 07-Jun-2020, at 9:50 AM, 'Christoph Kammer' via deal.II User
Group > wrote:

Hi Deal.ii team,

I went through tutorial step-4 and I tried to use the solver for
Poisson's problem in 2D and rewrite it for a 1D problem. This is
basically step-4 and setting RHS f =1 and solving for
homogeneous BCs. The program is compiling just fine and
executing, however, the solution I am getting from that doesn't
make any sense. The BCs aren't even satisfied at x = 1.

Could anyone let me know what's going on here? Setting f = 1 and
changing everything to solve for homogeneous BC in 1D seems like
a very simple problem.

Thank you,

Christoph


-- 
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 dea...@googlegroups.com .
To view this discussion on the web visit

https://groups.google.com/d/msgid/dealii/C66D5394-FFCF-426E-A66F-9F3CA5A0F7B0%40gmail.com

.


--
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/83222619-db7c-421f-bee1-3de1d485836ao%40googlegroups.com 
.


--
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
--- 

[deal.II] Strategy to snap the boundary of a triangulation to a manifold

2020-06-08 Thread Bruno Blais
Dear all,
I hope you are doing well.

In my endless quest for robust mesh generation of hex meshes using GMSH, I 
have managed to come up with a very robust strategy to generate hex-only 
meshes
My only issue (which is a major one) is that this implies that my 
decomposition from tet to hex adds nodes that are not "snapped" to the 
boundary, but that are only linear interpolation of the other node on the 
triangular faces.
Consequently, my quest remains unfulfilled.

Meshing through high-order and snapping the additional node to a high-order 
mesh from within GMSH is very troublesome and not very robust (and also 
very time consuming). However, an idea came to mind.
I was wondering if there could be an easy way to "snap" my faces to the 
manifold to which they belong.

My problem is thus the following:
- Given a triangulation and a manifold
- Some nodes are exactly on the manifolds (the original nodes of the tets) 
and some are not (the added nodes in the subdivision)
- What would be the best way to deform mesh so that the non-conforming node 
get deformed to the position which would be implied by the manifold? I 
think I could also make the process more robust by solving an additional 
elasticity equation during the deformation to deform the entire mesh 
instead of just the nodes close to the manifold.


Would any of you have a suggestion on how best to achieve the deformation 
of the nodes to match the manifold?


-- 
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/8d966870-4e33-4915-ad6c-2342018d82c3o%40googlegroups.com.


Re: [deal.II] Step-4 1D problem

2020-06-08 Thread 'peterrum' via deal.II User Group
Indeed! Christoph, you seem to be right!

Feel free to create a pull request on GitHub for this inconsistency! We 
will help you if you need some assistance! Amazing that there are still 
errors in the first tutorials although - probably - all deal.II user have 
had a look at these...

Thanks,
Peter

On Monday, 8 June 2020 17:50:25 UTC+2, Christoph Kammer wrote:
>
> Thank you Praveen,
>
> that solved my problem. After fixing the issue with the boundary id things 
> made sense. Is there a particular reason that in 1D the boundary points are 
> labeled in a different manner than in 2+ D?
>
> PS. deal ii team. In the documentation on step 3 + 4 it states that the 
> Poisson problem is solved on a domain [0,1]^dim. The actual solver however 
> is implemented to solve this problem on the domain [-1,1]^dim. Perhaps the 
> introduction to this tutorial should be made consistent with the commented 
> program.
>
>
> Thanks again,
>
>
> Christoph
>
>
> On 6/7/20 1:14 AM, Praveen C wrote:
>
> In 1-D, 
>
> GridGenerator::hyper_cube(triangulation, -1, 1);
>
> will assign different boundary indicators to left and right side, even 
> though colorize=false is default, see
>
>
> https://dealii.org/developer/doxygen/deal.II/namespaceGridGenerator.html#acea0cbcd68e52ce8113d1134b87de403
>
>  I think left=0 and right=1. Due to this reason, bc may not be applied on 
> both sides.
>
> Do the apply bc twice, once with indicator=0 and once with indicator=1.
>
>   std::map boundary_values;
>   VectorTools::interpolate_boundary_values(dof_handler,
>0, // left boundary
>BoundaryValues(),
>boundary_values);
>   MatrixTools::apply_boundary_values(boundary_values,
>  system_matrix,
>  solution,
>  system_rhs);
>
>   VectorTools::interpolate_boundary_values(dof_handler,
>1, // right boundary
>BoundaryValues(),
>boundary_values);
>   MatrixTools::apply_boundary_values(boundary_values,
>  system_matrix,
>  solution,
>  system_rhs);
>
> Best
> praveen
>
> On 07-Jun-2020, at 9:50 AM, 'Christoph Kammer' via deal.II User Group <
> dea...@googlegroups.com > wrote:
>
> Hi Deal.ii team,
>
> I went through tutorial step-4 and I tried to use the solver for Poisson's 
> problem in 2D and rewrite it for a 1D problem. This is basically step-4 and 
> setting RHS f =1 and solving for homogeneous BCs. The program is compiling 
> just fine and executing, however, the solution I am getting from that 
> doesn't make any sense. The BCs aren't even satisfied at x = 1.
>
> Could anyone let me know what's going on here? Setting f = 1 and changing 
> everything to solve for homogeneous BC in 1D seems like a very simple 
> problem.
>
> Thank you,
>
> Christoph
>
>
> -- 
> 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 dea...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/dealii/C66D5394-FFCF-426E-A66F-9F3CA5A0F7B0%40gmail.com
>  
> 
> .
>
>

-- 
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/83222619-db7c-421f-bee1-3de1d485836ao%40googlegroups.com.


Re: [deal.II] Step-4 1D problem

2020-06-08 Thread 'Christoph Kammer' via deal.II User Group

Thank you Praveen,

that solved my problem. After fixing the issue with the boundary id 
things made sense. Is there a particular reason that in 1D the boundary 
points are labeled in a different manner than in 2+ D?


PS. deal ii team. In the documentation on step 3 + 4 it states that the 
Poisson problem is solved on a domain [0,1]^dim. The actual solver 
however is implemented to solve this problem on the domain [-1,1]^dim. 
Perhaps the introduction to this tutorial should be made consistent with 
the commented program.



Thanks again,


Christoph


On 6/7/20 1:14 AM, Praveen C wrote:

In 1-D,

GridGenerator::hyper_cube(triangulation, -1, 1);

will assign different boundary indicators to left and right side, even 
though colorize=false is default, see


https://dealii.org/developer/doxygen/deal.II/namespaceGridGenerator.html#acea0cbcd68e52ce8113d1134b87de403

 I think left=0 and right=1. Due to this reason, bc may not be applied 
on both sides.


Do the apply bc twice, once with indicator=0 and once with indicator=1.

  std::map boundary_values;
VectorTools::interpolate_boundary_values(dof_handler,
0, // left boundary
BoundaryValues(),
boundary_values);
MatrixTools::apply_boundary_values(boundary_values,
system_matrix,
solution,
system_rhs);

VectorTools::interpolate_boundary_values(dof_handler,
1, // right boundary
BoundaryValues(),
boundary_values);
MatrixTools::apply_boundary_values(boundary_values,
                                  system_matrix,
                                  solution,
                                  system_rhs);

Best
praveen

On 07-Jun-2020, at 9:50 AM, 'Christoph Kammer' via deal.II User Group 
mailto:dealii@googlegroups.com>> wrote:


Hi Deal.ii team,

I went through tutorial step-4 and I tried to use the solver for 
Poisson's problem in 2D and rewrite it for a 1D problem. This is 
basically step-4 and setting RHS f =1 and solving for homogeneous 
BCs. The program is compiling just fine and executing, however, the 
solution I am getting from that doesn't make any sense. The BCs 
aren't even satisfied at x = 1.


Could anyone let me know what's going on here? Setting f = 1 and 
changing everything to solve for homogeneous BC in 1D seems like a 
very simple problem.


Thank you,

Christoph


--
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/C66D5394-FFCF-426E-A66F-9F3CA5A0F7B0%40gmail.com 
.


--
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/21d8b20b-3ae7-6e69-ff38-ab4494a8f27a%40googlemail.com.


Re: [deal.II] Re: Almost installed Deal II, but there is a fly in the ointment!

2020-06-08 Thread Bruno Blais
Dear Wilmar,

This is not a problem. Members of the deal.II user group are very friendly 
and very helpful. I was helped tremendously by a lot of people (JP 
Pelteret, Wolfgang, Luca) when I started. 
Feel free to try and help others when you become more accustomed.

PS : If you must know, I am from the great cold northern country of Canada. 
Land of noble and funny animals such as the moose and the beaver.

On Sunday, 7 June 2020 19:52:33 UTC-4, Wilmar Alves Cruvinel Lima wrote:
>
> Yes, I manage to install it!
>
> Thank you Bruno. 
>
> I don't know where you are from, but for sure it must be a very good place.
>
> Three months trying to install this very important software. It was 
> machines and operator limitations. It will be very important to my 
> Electrical Engineering graduation.
>
> Now I will resume The Finite Element Course on Cursera. 
>
> The step-1 example compiled and function!
>
> Sore for my naives questions. You are a nice person. Thank you again.
>
> Sincerely,
>
> Wilmar.
>
> Em dom., 7 de jun. de 2020 às 17:51, Wilmar Alves Cruvinel Lima <
> wilmar8...@gmail.com > escreveu:
>
>> Dear Bruno,
>>
>> I did only the commandmake. 
>>
>> It runs relatively fast. Now I put 
>>
>> make install
>>
>> After 1 1/2 hour it is on 70% of Building CXX object source...
>>
>> Until now noting is on /home/wilmar/dealii_library
>>
>> I hope that it will finish ok!
>>
>> Thank you again.
>>
>> Best regards.
>>
>> Wilmar. 
>>
>> Em Dom, 7 de jun de 2020 15:37, Bruno Blais > > escreveu:
>>
>>> Did you compile the library by using the "make install" command?
>>> Cmake only configures the build but does not compile the library per say.
>>> Best
>>> Bruno
>>>
>>>
>>> On Sunday, 7 June 2020 14:17:44 UTC-4, Wilmar Alves Cruvinel Lima wrote:

 Dear Bruno,

 Great! It functioned...

 I put the commands:
 wilmar@linuxmint:~/build$ *mkdir dealii_library*

 So, I put the command and it runned:
 wilmar@linuxmint:~/build$ *cmake /home/wilmar/dealii-9.1.1 
 -DCMAKE_INSTALL_PREFIX=/home/wilmar/dealii_library*
 -- This is CMake 3.10.2
 -- 
 -- Include /home/wilmar/dealii-9.1.1/cmake/setup_external_macros.cmake
 -- Include /home/wilmar/dealii-9.1.1/cmake/macros/macro_add_flags.cmake
 -- Include 
 /home/wilmar/dealii-9.1.1/cmake/macros/macro_check_compiler_setup.cmake
 -- Include 
 /home/wilmar/dealii-9.1.1/cmake/macros/macro_check_cxx_compiler_bug.cmake
 -- Include 
 /home/wilmar/dealii-9.1.1/cmake/macros/macro_check_mpi_interface.cmake
 . . .

 At the end, nothing was on  */home/wilmar/dealii_library.  *Maybe it 
 is on dealii-9.1.1 but I didn't localize. 

 In the last step I did something wrong?

 Em dom., 7 de jun. de 2020 às 13:41, Bruno Blais  
 escreveu:

> So there are two things you must keep in mind when you run cmake
>
>
> The command should be something similar to 
> cmake /path/to/dealii/sources 
> -DCMAKE_INSTALL_PREFIX=/path/to/where/you/want/to/install
>
> The first folder you point to is the folder you cloned the deal.II 
> sources to (which will contain a CMakeLists.txt
> The second folder you point to is where you want to install. Keep in 
> mind, the install directory should be different from the build directory.
> What happens is that you go from the sources to a build folder, and 
> then you install the library. The build folder is an intermediary folder.
>
> Best
> Bruno
>
>
>
>
> On Sunday, 7 June 2020 12:06:38 UTC-4, Wilmar Alves Cruvinel Lima 
> wrote:
>>
>> Thank you Bruno,
>>
>> Yes, the valid path, I think, is  */home/wilmar/build . *Orientation 
>> on *https://www.dealii.org/current/readme.html 
>> * inform a different 
>> directory from unpacked Deal.II.
>>
>> So, I returned to run cmake again, with the command:
>> wilmar@linuxmint:~build$ 
>> *cmake -DCMAKE_INSTALL_PREFIX=/home/wilmar/build*
>> but cmake missed the CMakeLists.txt:   
>> *CMake Error: The source directory "/home/wilmar/build" does not 
>> appear to contain CMakeLists.txt*
>>
>> Yes, CMakeLists.txt isn't on /home/wilmar/build. I don't know where 
>> the CMakeLists.txt for this compilation is. 
>>
>> Thank you in advance for orientation!
>>
>> Wilmar (Brazil)  -  Running from Covid!
>>
>>
>> Em dom., 7 de jun. de 2020 às 12:03, Bruno Blais  
>> escreveu:
>>
>>> Hello,
>>> You are getting this error because the installation path that you 
>>> specified is not valid.
>>> When you did you cmake command, you specific the installation path 
>>> to :  */path/to/install/dir/share/deal.II/scripts*
>>> This path on your linux machine is not a valid path, and 
>>> consequently, this folder cannot be created.
>>> You need to run cmake again and 

[deal.II] Re: Broadcasting packed objects

2020-06-08 Thread 'peterrum' via deal.II User Group
Dear Maurice,

The problem is that the size of `auto buffer = 
dealii::Utilities::pack(r1);` is not the same on all processes, which is a 
requirement if you use `MPI_Bcast`. My suggestion would to split the 
procedure into two steps: 1) bcast the size on rank 1; 2) bcast the actual 
data.

Peter

On Monday, 8 June 2020 12:46:53 UTC+2, Maurice Rohracker wrote:
>
> Dear deal.II community,
>
> For a distributed implementation, we would like to broadcast packed data 
> objects.
>
> For the beginning, we would like to understand how the serialize function 
> for packing an object is working in the sense of the deal.II way, before it 
> is getting more complicated.
>
> I created a small test with a class, which should be broadcasted. As a 
> comparison, I took the dealii:Point, which can obviously be packed and 
> broadcasted without any issues.
>
> Unfortunately, the broadcast for our class does not work. We assume that 
> our serialize function is not in the correct manner. Is it possible to pack 
> own objects using the dealii::Utilities:pack() function? What is the proper 
> way defining the serialize function?
>
> Attached you'll find our small example code. We are using deal.II 9.0.1.
>
> Thank you very much in advance.
>
> Best regards,
> Maurice Rohracker
> Master Student Computational Engineering
> FAU Erlange-Nürnberg
>

-- 
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/2b2fb018-0dfd-497a-a1df-9372f74e9e23o%40googlegroups.com.


[deal.II] Broadcasting packed objects

2020-06-08 Thread Maurice Rohracker
Dear deal.II community,

For a distributed implementation, we would like to broadcast packed data 
objects.

For the beginning, we would like to understand how the serialize function 
for packing an object is working in the sense of the deal.II way, before it 
is getting more complicated.

I created a small test with a class, which should be broadcasted. As a 
comparison, I took the dealii:Point, which can obviously be packed and 
broadcasted without any issues.

Unfortunately, the broadcast for our class does not work. We assume that 
our serialize function is not in the correct manner. Is it possible to pack 
own objects using the dealii::Utilities:pack() function? What is the proper 
way defining the serialize function?

Attached you'll find our small example code. We are using deal.II 9.0.1.

Thank you very much in advance.

Best regards,
Maurice Rohracker
Master Student Computational Engineering
FAU Erlange-Nürnberg

-- 
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/cc9c1b57-3c12-4417-9935-6e65f569aeb6o%40googlegroups.com.
cmake_minimum_required(VERSION 3.10)
set(CMAKE_BUILD_TYPE Release)

find_package(MPI)
include_directories(SYSTEM ${MPI_INCLUDE_PATH})

# Ensure dealii is present
SET(DEAL_II_DIR /usr/local/bin/dealii/)
FIND_PACKAGE(deal.II 9.0.0 QUIET
HINTS ${deal.II_DIR} ${DEAL_II_DIR} $ENV{DEAL_II_DIR}
)
IF(NOT ${deal.II_FOUND})
MESSAGE(FATAL_ERROR "\n"
"*** Could not locate a (sufficiently recent) version of deal.II. 
***\n\n"
"You may want to either pass a flag -DDEAL_II_DIR=/path/to/deal.II 
to cmake\n"
"or set an environment variable \"DEAL_II_DIR\" that contains this 
path."
)
ENDIF()
SET(CMAKE_CXX_COMPILER mpicxx)

add_executable(serializationTest serializationTestMain.cpp)

target_link_libraries(serializationTest ${MPI_CPP_LIBRARIES})
DEAL_II_SETUP_TARGET(serializationTest)
//
// Created by Maurice on 04.06.2020.
//

#ifndef SERIALIZATIONTEST_ROOM_H
#define SERIALIZATIONTEST_ROOM_H

#include 

class Room {
private:
int nWindows;
int nDoors;

public:
Room() : nWindows(0), nDoors(0) { }

Room(int nW, int nD) : nWindows(nW), nDoors(nD) { }

~Room() { }

Room(const Room ) : nWindows(other.nWindows), nDoors(other.nDoors) { }

Room& operator=(const Room ) {
if (this != ) {
nWindows = other.nWindows;
nDoors = other.nDoors;
}
return *this;
}

void setWindows(int n) {
nWindows = n;
}

void setDoors(int n) {
nDoors = n;
}

std::string print() const {
return "number of windows: " + std::to_string(nWindows) + " | number of doors: " + std::to_string(nDoors);
}

template
void serialize(Archive , const unsigned int version);
};

template
inline
void
Room::serialize(Archive & ar, const unsigned int version) {
ar & nWindows;
ar & nDoors;
}

#endif //SERIALIZATIONTEST_ROOM_H
//
// Created by Maurice on 03.06.2020.
//

#include "mpi.h"
#include 
#include 
#include 
#include 
#include "Room.h"


int main(int argc, char *argv[]) {
  dealii::Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
  MPI_Comm const & mpi_communicator(MPI_COMM_WORLD);

  Room r1;
  const unsigned dim = 5;
  dealii::Point p1;
  if (dealii::Utilities::MPI::this_mpi_process(mpi_communicator) == 0) {
  r1.setWindows(4);
  r1.setDoors(6);
  for(int i = 0; i < dim; ++i)
  p1[i] = i + 2;
}

  // pack objects
  auto buffer = dealii::Utilities::pack(r1);
  auto bufferPoint = dealii::Utilities::pack(p1);

  // broadcast objects
  MPI_Bcast([0], buffer.size(), MPI_CHAR, 0, mpi_communicator); // with commenting this line the code works without errors
  MPI_Bcast([0], bufferPoint.size(), MPI_CHAR, 0, mpi_communicator);


  // unpack objects (if not root process)
  if (dealii::Utilities::MPI::this_mpi_process(mpi_communicator) != 0) {
  r1 = dealii::Utilities::unpack(buffer);
  p1 = dealii::Utilities::unpack >(bufferPoint);
}

  // print to see, if all worked
  std::cout << "Hello form "
<< dealii::Utilities::MPI::this_mpi_process(mpi_communicator)
<< " of "
<< dealii::Utilities::MPI::n_mpi_processes(mpi_communicator)
<< std::endl;
  std::cout << "Process: "
<< dealii::Utilities::MPI::this_mpi_process(mpi_communicator) << " "
<< r1.print() << std::endl;
  std::cout << "Process: "
<< dealii::Utilities::MPI::this_mpi_process(mpi_communicator) << std::endl;
  for(int i = 0; i < dim; ++i)

[deal.II] Re: hp fem error assigning Fourier

2020-06-08 Thread Marc Fehling
Hi Ishan!

You are correct: We opted for a more versatile approach in transforming 
solutions into Fourier or Legendre series with deal.II 9.2. Glad you 
figured it out!

Marc

-- 
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/4e2f4bba-e2a6-4269-acb1-21bf03b2126co%40googlegroups.com.


[deal.II] Re: hp fem error assigning Fourier

2020-06-08 Thread A.Z Ihsan
Hi Peter, 

yes, it is solved now. Thanks Peter. 

In deal.ii 9.2.0 the implementation detail of FESeries::Fourier constructor 
can take the first argument  of std::vector, meanwhile in 
deal.ii 9.1 only unsigned int.

BR, 
Ihsan

On Monday, June 8, 2020 at 10:10:18 AM UTC+2, peterrum wrote:
>
> Dear Ihsan,
>
> is the issue solved now? I have compiled your code with the current 
> version of deal.II and it works.
>
> Peter 
>
> On Monday, 8 June 2020 09:56:21 UTC+2, A.Z Ihsan wrote:
>>
>> Oops, i was wrong. I followed the deal.ii 9.2.0 tutorial meanwhile in my 
>> local deal.ii version is 9.1.
>> There is a couple different implementation in terms of FESeries::Fourier.
>>
>> On Friday, June 5, 2020 at 12:25:47 PM UTC+2, A.Z Ihsan wrote:
>>>
>>> Hi Peter, 
>>> thank you for the answer. Actually i did put the fe_series.h. 
>>> I forgot to mention that the problem arise when i use template 
>>> specialization by the end the implementation
>>>
>>> #include 
>>> #include 
>>> #include 
>>> #include 
>>>
>>> using namespace dealii;
>>>
>>> namespace hpfe{
>>> template 
>>> class HPSolver
>>> {
>>> public:
>>>  HPSolver(
>>>  const unsigned int max_fe_degree);
>>>  //virtual ~HPSolver();
>>>
>>> const hp::FECollection& get_fe_collection();
>>>  const hp::QCollection& get_face_quadrature_collection();   
>>>  
>>> protected:
>>>  hp::FECollection fe_collection;
>>>  hp::QCollection quadrature_collection;
>>>  hp::QCollection face_quadrature_collection;
>>>  hp::QCollection  fourier_q_collection;
>>>  std::unique_ptr> fourier;
>>>  std::vector ln_k;
>>>  Table>fourier_coefficients;
>>> };
>>>
>>> template 
>>> HPSolver::HPSolver(
>>>  const unsigned int max_degree)
>>> {
>>>  for (unsigned int degree=2; degree <= max_degree; ++degree)
>>>{
>>>  fe_collection.push_back(FE_Q(degree));
>>>  quadrature_collection.push_back(QGauss(degree+1));
>>>  face_quadrature_collection.push_back(QGauss(degree+1));
>>>}
>>>  const unsigned int N = max_degree;
>>>  QGauss<1>  base_quadrature(2);
>>>  QIterated quadrature(base_quadrature, N);
>>>  for (unsigned int i = 0; i < fe_collection.size(); i++)
>>>fourier_q_collection.push_back(quadrature);
>>>  std::vector n_coefficients_per_direction(fe_collection.
>>> size(), N);
>>>  fourier = std::make_unique>(n_coefficients_per_
>>> direction, fe_collection, fourier_q_collection);
>>>  //resize(fourier_coefficients, N);
>>> }
>>> }
>>> template class hpfe::HPSolver<3, Vector> ;
>>>
>>> can you try once more?
>>>
>>> BR, 
>>> ihsan
>>>
>>>
 On Friday, 5 June 2020 10:40:29 UTC+2, A.Z Ihsan wrote:
>
>
> Hi All, 
>
> I am trying to implement hp-fem into my problem according to the 
> step-27. But, i have an error when i am trying to compile, 
>
> error: no matching function for call to 'dealii::FESeries::Fourier<3, 
>> 3>::Fourier(std::vector&, dealii::hp::FECollection<3, 3>&, 
>> dealii::hp::QCollection<3>&)'
>>  { return unique_ptr<_Tp>(new 
>> _Tp(std::forward<_Args>(__args)...)); }
>
>
> i believe there is a mistake in assigning fourier, but i copied the 
> step-27 exactly. 
> Here is the code snippet... could someone help me?
>
> template 
> class HPSolver
> {
> public:
> HPSolver(
> const unsigned int max_fe_degree);
> virtual ~HPSolver();
>
> const hp::FECollection& get_fe_collection();
> const hp::QCollection& get_face_quadrature_collection();   
>  
> protected:
> hp::FECollection fe_collection;
> hp::QCollection quadrature_collection;
> hp::QCollection face_quadrature_collection;
> hp::QCollection  fourier_q_collection;
> std::unique_ptr> fourier;
> std::vector ln_k;
> Table>fourier_coefficients;
> };
>
> template 
> HPSolver::HPSolver(
> const unsigned int max_degree,
> :
> max_fe_degree(max_degree)
> {
> for (unsigned int degree=2; degree <= max_fe_degree; ++degree)
>   {
> fe_collection.push_back(FE_Q(degree));
> quadrature_collection.push_back(QGauss(degree+1));
> face_quadrature_collection.push_back(QGauss(degree+1));
>   }
> const unsigned int N = max_fe_degree;
> QGauss<1>  base_quadrature(2);
> QIterated quadrature(base_quadrature, N);
> for (unsigned int i = 0; i < fe_collection.size(); i++)
>   fourier_q_collection.push_back(quadrature);
> std::vector 
> n_coefficients_per_direction(fe_collection.size(), N);
> fourier = 
> std_cxx14::make_unique>(n_coefficients_per_direction,
>  
> fe_collection, fourier_q_collection);
> resize(fourier_coefficients, N);
> }
>
> BR, 
> Ihsan
>


-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, 

[deal.II] Re: hp fem error assigning Fourier

2020-06-08 Thread 'peterrum' via deal.II User Group
Dear Ihsan,

is the issue solved now? I have compiled your code with the current version 
of deal.II and it works.

Peter 

On Monday, 8 June 2020 09:56:21 UTC+2, A.Z Ihsan wrote:
>
> Oops, i was wrong. I followed the deal.ii 9.2.0 tutorial meanwhile in my 
> local deal.ii version is 9.1.
> There is a couple different implementation in terms of FESeries::Fourier.
>
> On Friday, June 5, 2020 at 12:25:47 PM UTC+2, A.Z Ihsan wrote:
>>
>> Hi Peter, 
>> thank you for the answer. Actually i did put the fe_series.h. 
>> I forgot to mention that the problem arise when i use template 
>> specialization by the end the implementation
>>
>> #include 
>> #include 
>> #include 
>> #include 
>>
>> using namespace dealii;
>>
>> namespace hpfe{
>> template 
>> class HPSolver
>> {
>> public:
>>  HPSolver(
>>  const unsigned int max_fe_degree);
>>  //virtual ~HPSolver();
>>
>> const hp::FECollection& get_fe_collection();
>>  const hp::QCollection& get_face_quadrature_collection();   
>>  
>> protected:
>>  hp::FECollection fe_collection;
>>  hp::QCollection quadrature_collection;
>>  hp::QCollection face_quadrature_collection;
>>  hp::QCollection  fourier_q_collection;
>>  std::unique_ptr> fourier;
>>  std::vector ln_k;
>>  Table>fourier_coefficients;
>> };
>>
>> template 
>> HPSolver::HPSolver(
>>  const unsigned int max_degree)
>> {
>>  for (unsigned int degree=2; degree <= max_degree; ++degree)
>>{
>>  fe_collection.push_back(FE_Q(degree));
>>  quadrature_collection.push_back(QGauss(degree+1));
>>  face_quadrature_collection.push_back(QGauss(degree+1));
>>}
>>  const unsigned int N = max_degree;
>>  QGauss<1>  base_quadrature(2);
>>  QIterated quadrature(base_quadrature, N);
>>  for (unsigned int i = 0; i < fe_collection.size(); i++)
>>fourier_q_collection.push_back(quadrature);
>>  std::vector n_coefficients_per_direction(fe_collection.
>> size(), N);
>>  fourier = std::make_unique>(n_coefficients_per_
>> direction, fe_collection, fourier_q_collection);
>>  //resize(fourier_coefficients, N);
>> }
>> }
>> template class hpfe::HPSolver<3, Vector> ;
>>
>> can you try once more?
>>
>> BR, 
>> ihsan
>>
>>
>>> On Friday, 5 June 2020 10:40:29 UTC+2, A.Z Ihsan wrote:


 Hi All, 

 I am trying to implement hp-fem into my problem according to the 
 step-27. But, i have an error when i am trying to compile, 

 error: no matching function for call to 'dealii::FESeries::Fourier<3, 
> 3>::Fourier(std::vector&, dealii::hp::FECollection<3, 3>&, 
> dealii::hp::QCollection<3>&)'
>  { return unique_ptr<_Tp>(new 
> _Tp(std::forward<_Args>(__args)...)); }


 i believe there is a mistake in assigning fourier, but i copied the 
 step-27 exactly. 
 Here is the code snippet... could someone help me?

 template 
 class HPSolver
 {
 public:
 HPSolver(
 const unsigned int max_fe_degree);
 virtual ~HPSolver();

 const hp::FECollection& get_fe_collection();
 const hp::QCollection& get_face_quadrature_collection();   
  
 protected:
 hp::FECollection fe_collection;
 hp::QCollection quadrature_collection;
 hp::QCollection face_quadrature_collection;
 hp::QCollection  fourier_q_collection;
 std::unique_ptr> fourier;
 std::vector ln_k;
 Table>fourier_coefficients;
 };

 template 
 HPSolver::HPSolver(
 const unsigned int max_degree,
 :
 max_fe_degree(max_degree)
 {
 for (unsigned int degree=2; degree <= max_fe_degree; ++degree)
   {
 fe_collection.push_back(FE_Q(degree));
 quadrature_collection.push_back(QGauss(degree+1));
 face_quadrature_collection.push_back(QGauss(degree+1));
   }
 const unsigned int N = max_fe_degree;
 QGauss<1>  base_quadrature(2);
 QIterated quadrature(base_quadrature, N);
 for (unsigned int i = 0; i < fe_collection.size(); i++)
   fourier_q_collection.push_back(quadrature);
 std::vector 
 n_coefficients_per_direction(fe_collection.size(), N);
 fourier = 
 std_cxx14::make_unique>(n_coefficients_per_direction,
  
 fe_collection, fourier_q_collection);
 resize(fourier_coefficients, N);
 }

 BR, 
 Ihsan

>>>

-- 
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/59bc6f2b-6fbc-4fd9-840f-6f491004450bo%40googlegroups.com.


[deal.II] Re: hp fem error assigning Fourier

2020-06-08 Thread A.Z Ihsan
Oops, i was wrong. I followed the deal.ii 9.2.0 tutorial meanwhile in my 
local deal.ii version is 9.1.
There is a couple different implementation in terms of FESeries::Fourier.

On Friday, June 5, 2020 at 12:25:47 PM UTC+2, A.Z Ihsan wrote:
>
> Hi Peter, 
> thank you for the answer. Actually i did put the fe_series.h. 
> I forgot to mention that the problem arise when i use template 
> specialization by the end the implementation
>
> #include 
> #include 
> #include 
> #include 
>
> using namespace dealii;
>
> namespace hpfe{
> template 
> class HPSolver
> {
> public:
>  HPSolver(
>  const unsigned int max_fe_degree);
>  //virtual ~HPSolver();
>
> const hp::FECollection& get_fe_collection();
>  const hp::QCollection& get_face_quadrature_collection();   
>  
> protected:
>  hp::FECollection fe_collection;
>  hp::QCollection quadrature_collection;
>  hp::QCollection face_quadrature_collection;
>  hp::QCollection  fourier_q_collection;
>  std::unique_ptr> fourier;
>  std::vector ln_k;
>  Table>fourier_coefficients;
> };
>
> template 
> HPSolver::HPSolver(
>  const unsigned int max_degree)
> {
>  for (unsigned int degree=2; degree <= max_degree; ++degree)
>{
>  fe_collection.push_back(FE_Q(degree));
>  quadrature_collection.push_back(QGauss(degree+1));
>  face_quadrature_collection.push_back(QGauss(degree+1));
>}
>  const unsigned int N = max_degree;
>  QGauss<1>  base_quadrature(2);
>  QIterated quadrature(base_quadrature, N);
>  for (unsigned int i = 0; i < fe_collection.size(); i++)
>fourier_q_collection.push_back(quadrature);
>  std::vector n_coefficients_per_direction(fe_collection.size
> (), N);
>  fourier = std::make_unique>(n_coefficients_per_
> direction, fe_collection, fourier_q_collection);
>  //resize(fourier_coefficients, N);
> }
> }
> template class hpfe::HPSolver<3, Vector> ;
>
> can you try once more?
>
> BR, 
> ihsan
>
>
>> On Friday, 5 June 2020 10:40:29 UTC+2, A.Z Ihsan wrote:
>>>
>>>
>>> Hi All, 
>>>
>>> I am trying to implement hp-fem into my problem according to the 
>>> step-27. But, i have an error when i am trying to compile, 
>>>
>>> error: no matching function for call to 'dealii::FESeries::Fourier<3, 
 3>::Fourier(std::vector&, dealii::hp::FECollection<3, 3>&, 
 dealii::hp::QCollection<3>&)'
  { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); 
 }
>>>
>>>
>>> i believe there is a mistake in assigning fourier, but i copied the 
>>> step-27 exactly. 
>>> Here is the code snippet... could someone help me?
>>>
>>> template 
>>> class HPSolver
>>> {
>>> public:
>>> HPSolver(
>>> const unsigned int max_fe_degree);
>>> virtual ~HPSolver();
>>>
>>> const hp::FECollection& get_fe_collection();
>>> const hp::QCollection& get_face_quadrature_collection();   
>>>  
>>> protected:
>>> hp::FECollection fe_collection;
>>> hp::QCollection quadrature_collection;
>>> hp::QCollection face_quadrature_collection;
>>> hp::QCollection  fourier_q_collection;
>>> std::unique_ptr> fourier;
>>> std::vector ln_k;
>>> Table>fourier_coefficients;
>>> };
>>>
>>> template 
>>> HPSolver::HPSolver(
>>> const unsigned int max_degree,
>>> :
>>> max_fe_degree(max_degree)
>>> {
>>> for (unsigned int degree=2; degree <= max_fe_degree; ++degree)
>>>   {
>>> fe_collection.push_back(FE_Q(degree));
>>> quadrature_collection.push_back(QGauss(degree+1));
>>> face_quadrature_collection.push_back(QGauss(degree+1));
>>>   }
>>> const unsigned int N = max_fe_degree;
>>> QGauss<1>  base_quadrature(2);
>>> QIterated quadrature(base_quadrature, N);
>>> for (unsigned int i = 0; i < fe_collection.size(); i++)
>>>   fourier_q_collection.push_back(quadrature);
>>> std::vector 
>>> n_coefficients_per_direction(fe_collection.size(), N);
>>> fourier = 
>>> std_cxx14::make_unique>(n_coefficients_per_direction,
>>>  
>>> fe_collection, fourier_q_collection);
>>> resize(fourier_coefficients, N);
>>> }
>>>
>>> BR, 
>>> Ihsan
>>>
>>

-- 
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/8fdb3fe9-05db-4cc6-a789-12950800b256o%40googlegroups.com.