Commit d3e705e8 authored by gsell's avatar gsell

bugfix in reading fieldmaps in H5hut format

- used index scheme was C but FORTRAN must be used!
parent 99361fd6
...@@ -65,7 +65,9 @@ void FM3DH5Block::readMap ( ...@@ -65,7 +65,9 @@ void FM3DH5Block::readMap (
&(FieldstrengthHz_m[0])); &(FieldstrengthHz_m[0]));
closeFile (); closeFile ();
INFOMSG (level3 << typeset_msg("fieldmap '" + Filename_m + "' read", "info") INFOMSG (level3
<< typeset_msg("3d dynamic fieldmap '"
+ Filename_m + "' (H5hut format) read", "info")
<< endl); << endl);
} }
...@@ -81,8 +83,9 @@ void FM3DH5Block::freeMap ( ...@@ -81,8 +83,9 @@ void FM3DH5Block::freeMap (
FieldstrengthHy_m.clear (); FieldstrengthHy_m.clear ();
FieldstrengthHz_m.clear (); FieldstrengthHz_m.clear ();
INFOMSG(level3 << typeset_msg("freed fieldmap '" + Filename_m + "'", "info") INFOMSG (level3
<< endl); << typeset_msg ("freed fieldmap '" + Filename_m + "'", "info")
<< endl);
} }
bool FM3DH5Block::getFieldstrength ( bool FM3DH5Block::getFieldstrength (
...@@ -93,11 +96,8 @@ bool FM3DH5Block::getFieldstrength ( ...@@ -93,11 +96,8 @@ bool FM3DH5Block::getFieldstrength (
if (!isInside(R)) { if (!isInside(R)) {
return true; return true;
} }
E += interpolateTrilinearly ( E += interpolateTrilinearly (FieldstrengthEx_m, FieldstrengthEy_m, FieldstrengthEz_m, R);
FieldstrengthEx_m, FieldstrengthEy_m, FieldstrengthEz_m, R); B += interpolateTrilinearly (FieldstrengthHx_m, FieldstrengthHy_m, FieldstrengthHz_m, R);
B += interpolateTrilinearly (
FieldstrengthHx_m, FieldstrengthHy_m, FieldstrengthHz_m, R);
return false; return false;
} }
......
...@@ -137,13 +137,20 @@ protected: ...@@ -137,13 +137,20 @@ protected:
{} {}
}; };
/*
The 3-dimensional fieldmaps are stored in a 1-dimensional arrays.
Please note that the FORTRAN indexing scheme is used in H5hut!
This functions maps the 3-dimensional index (i, j, k) to the
corresponding index in the 1-dimensional array.
*/
unsigned long getIndex ( unsigned long getIndex (
unsigned int i, unsigned int i,
unsigned int j, unsigned int j,
unsigned int k unsigned int k
) const { ) const {
unsigned long result = i + j * num_gridpx_m; unsigned long result = j + k * num_gridpy_m;
result = k + result * num_gridpz_m; result = i + result * num_gridpx_m;
return result; return result;
} }
......
...@@ -77,7 +77,9 @@ void FM3DH5Block_nonscale::readMap ( ...@@ -77,7 +77,9 @@ void FM3DH5Block_nonscale::readMap (
FieldstrengthHy_m[i] *= 1.0e6 * Physics::mu_0 ; FieldstrengthHy_m[i] *= 1.0e6 * Physics::mu_0 ;
FieldstrengthHz_m[i] *= 1.0e6 * Physics::mu_0 ; FieldstrengthHz_m[i] *= 1.0e6 * Physics::mu_0 ;
} }
INFOMSG (level3 << typeset_msg("fieldmap '" + Filename_m + "' read", "info") INFOMSG (level3
<< typeset_msg("3d dynamic (non-scaled) fieldmap '"
+ Filename_m + "' (H5hut format) read", "info")
<< endl); << endl);
} }
......
...@@ -67,7 +67,9 @@ void FM3DMagnetoStaticH5Block::readMap ( ...@@ -67,7 +67,9 @@ void FM3DMagnetoStaticH5Block::readMap (
&(FieldstrengthBz_m[0])); &(FieldstrengthBz_m[0]));
closeFile (); closeFile ();
INFOMSG (level3 << typeset_msg("fieldmap '" + Filename_m + "' read", "info") INFOMSG (level3
<< typeset_msg("3d magneto static fieldmap '"
+ Filename_m + "' (H5hut format) read", "info")
<< endl); << endl);
} }
void FM3DMagnetoStaticH5Block::freeMap ( void FM3DMagnetoStaticH5Block::freeMap (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment