Mailing List picongpu-users@hzdr.de Message #70
From: Huebl, Axel <a.huebl@hzdr.de>
Subject: Re: [PIConGPU-Users] Field initializers
Date: Thu, 16 Jun 2016 11:05:37 +0200
To: <picongpu-users@hzdr.de>
Signed Data (Text SHA256)
Hi Danila,

> 1. If there is a way how to switch on the c++11 support for a
> compilation?

works only in `dev` right now, just configure (run cmake) with
  configure -c"-DCMAKE_CXX_STANDARD=11" [...]

nevertheless, this is only a *warning* and still works.
just move your "test" variable *inside* the operator() to get rid of the
error "function-scope static variables cannot be initialized".

> 2. If there is a less dirty way how to plug in a custom gas profile?
> The custom HDF5 file is mentioned in the code, however I didn't find
> the way how to use...

0.1.2:
  - componentsConfig.param: gasFreeFormula https://git.io/vo0zM
  - gasConfig.param: den(x,y,z) https://git.io/vo0z9

so you can define anything you can describe as a function
  f(x, y, z) -> density

is that not general enough?

The alternative is "gasFromHdf5" where you pre-discretize a gas profile
you want to use. I am thinking about providing a python-toolchain to
build such files in the future from primitives [1], but for now one can
simply create it with the same resolution as the planned simulation e.g.
via matlab, h5py or what ever tool can write a HDF5 file with the
density information (a very simple scalar matrix).

> BTW, is it thread safe to read a gas profile from the file?

Depends which kind of threads you refer to. PIConGPU's threads reading
the file are of course coordinated reads and save, but you should not
modify the gas profile file while PIConGPU is reading it.


Best,
Axel

[1] https://github.com/ComputationalRadiationPhysics/picongpu/issues/1502

On 14.06.2016 11:31, Khikhlukha Danila wrote:
> Dear all,
> I'm trying to tweak the gasProfile structure a bit. In fact I want to
> specify a custom 1D gas distribution.
> So currently I'm trying to initialize an array inside a gasProfile
> declaration code:
>             struct
> GasProfile                                                                                          
>
>            
> {                                                                                                          
>
>
>                 ....
>                                                                                                      
>
>                 const float_64 test[10] =
> {0,1,2,3,4,5,6,7,8,9};                                                      
>
>                 DINLINE float_64 operator()( floatD_64 pos )
>                 {....
>
> The code above gives an error during the compilation
> .../simulation_defines/param/gasConfig.param(213): warning: field
> initializers are a C++11 feature
> .../simulation_defines/param/gasConfig.param(213): warning: field
> initializers are a C++11 feature
> .../simulation_defines/param/gasConfig.param(200) (col. 37): error:
> Internal Compiler Error (codegen): "function-scope static variables
> cannot be initialized!"
>
> So my questions are:
> 1. If there is a way how to switch on the c++11 support for a
> compilation? (w.r.t.
> https://github.com/ComputationalRadiationPhysics/picongpu/issues/1147)
>
> 2. If there is a less dirty way how to plug in a custom gas profile? The
> custom HDF5 file is mentioned in the code, however I didn't find the way
> how to use... BTW, is it thread safe to read a gas profile from the file?
>
> Thank you in advance,
> Danila.
>
>

--

Axel Huebl
Phone +49 351 260 3582
https://www.hzdr.de/crp
Computational Radiation Physics
Laser Particle Acceleration Division
Helmholtz-Zentrum Dresden - Rossendorf e.V.

Bautzner Landstrasse 400, 01328 Dresden
POB 510119, D-01314 Dresden
Vorstand: Prof. Dr.Dr.h.c. R. Sauerbrey
          Prof. Dr.Dr.h.c. P. Joehnk
VR 1693 beim Amtsgericht Dresden

Content Unaltered as verified By:
Huebl, Axel <a.huebl@hzdr.de>
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster