Skip to content

Commit

Permalink
add position attribute to mesh data
Browse files Browse the repository at this point in the history
  • Loading branch information
PrometheusPi committed Jan 11, 2016
1 parent 3dce254 commit 47597de
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions src/picongpu/include/plugins/radiation/Radiation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,9 @@ class Radiation : public ISimulationPlugin
Amplitude UnityAmplitude(1., 0., 0., 0., 0., 0.);
const picongpu::float_64 factor = UnityAmplitude.calc_radiation() * UNIT_ENERGY * UNIT_TIME ;

typedef PICToSplash<float_X>::type SplashFloatXType;
SplashFloatXType splashFloatXType;

for(uint32_t ampIndex=0; ampIndex < Amplitude::numComponents; ++ampIndex)
{
splash::Dimensions offset(ampIndex,0,0);
Expand All @@ -691,6 +694,16 @@ class Radiation : public ISimulationPlugin
(meshesPathName + dataLabels(ampIndex)).c_str(),
"unitSI",
&factor);

/* position */
std::vector<float_X> positionMesh(simDim, 0.0); /* there is no offset - zero */
HDF5dataFile.writeAttribute(currentStep,
splashFloatXType,
(meshesPathName + dataLabels(ampIndex)).c_str(),
"position",
1u,
splash::Dimensions(simDim,0,0),
&(*positionMesh.begin()));
}

/* save SI unit as attribute in the Amplitude group (for convenience) */
Expand Down Expand Up @@ -734,6 +747,16 @@ class Radiation : public ISimulationPlugin
"unitSI",
&factorDirection);

/* position */
std::vector<float_X> positionMesh(simDim, 0.0); /* there is no offset - zero */
HDF5dataFile.writeAttribute(currentStep,
splashFloatXType,
(meshesPathName + dataLabelsDetectorDirection(detectorDim)).c_str(),
"position",
1u,
splash::Dimensions(simDim,0,0),
&(*positionMesh.begin()));

}


Expand Down Expand Up @@ -766,6 +789,17 @@ class Radiation : public ISimulationPlugin
"unitSI",
&factorOmega);

/* position */
std::vector<float_X> positionMesh(simDim, 0.0); /* there is no offset - zero */
HDF5dataFile.writeAttribute(currentStep,
splashFloatXType,
(meshesPathName + dataLabelsDetectorFrequency(0)).c_str(),
"position",
1u,
splash::Dimensions(simDim,0,0),
&(*positionMesh.begin()));


/* begin openPMD attributes */
/* begin required openPMD global attributes */
std::string openPMDversion("1.0.0");
Expand Down Expand Up @@ -812,8 +846,6 @@ class Radiation : public ISimulationPlugin
"iterationFormat",
iterationFormat.c_str() );

typedef PICToSplash<float_X>::type SplashFloatXType;
SplashFloatXType splashFloatXType;
HDF5dataFile.writeAttribute(currentStep, splashFloatXType, NULL, "dt", &DELTA_T);
const float_X time = float_X(currentStep) * DELTA_T;
HDF5dataFile.writeAttribute(currentStep, splashFloatXType, NULL, "time", &time);
Expand Down

0 comments on commit 47597de

Please sign in to comment.