Commit 452819da authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Same treatment for the parallel i/o routines.

parent 981ae243
......@@ -211,9 +211,25 @@ void writeArray(hid_t grp, char* fileName, FILE* xmfFile,
if (temp == NULL) error("Unable to allocate memory for temporary buffer");
/* Copy particle data to temporary buffer */
char* temp_c = temp;
for (size_t i = 0; i < N; ++i)
memcpy(&temp_c[i * copySize], props.field + i * props.partSize, copySize);
if (props.convert_part == NULL &&
props.convert_gpart == NULL) { /* No conversion */
char* temp_c = temp;
for (size_t i = 0; i < N; ++i)
memcpy(&temp_c[i * copySize], props.field + i * props.partSize, copySize);
} else if (props.convert_part != NULL) { /* conversion (for parts)*/
float* temp_f = temp;
for (size_t i = 0; i < N; ++i)
temp_f[i] = props.convert_part(&props.parts[i]);
} else if (props.convert_gpart != NULL) { /* conversion (for gparts)*/
float* temp_f = temp;
for (size_t i = 0; i < N; ++i)
temp_f[i] = props.convert_gpart(&props.gparts[i]);
}
/* Unit conversion if necessary */
const double factor =
......
......@@ -298,9 +298,25 @@ void writeArray(hid_t grp, char* fileName, FILE* xmfFile,
if (temp == NULL) error("Unable to allocate memory for temporary buffer");
/* Copy particle data to temporary buffer */
char* temp_c = temp;
for (size_t i = 0; i < N; ++i)
memcpy(&temp_c[i * copySize], props.field + i * props.partSize, copySize);
if (props.convert_part == NULL &&
props.convert_gpart == NULL) { /* No conversion */
char* temp_c = temp;
for (size_t i = 0; i < N; ++i)
memcpy(&temp_c[i * copySize], props.field + i * props.partSize, copySize);
} else if (props.convert_part != NULL) { /* conversion (for parts)*/
float* temp_f = temp;
for (size_t i = 0; i < N; ++i)
temp_f[i] = props.convert_part(&props.parts[i]);
} else if (props.convert_gpart != NULL) { /* conversion (for gparts)*/
float* temp_f = temp;
for (size_t i = 0; i < N; ++i)
temp_f[i] = props.convert_gpart(&props.gparts[i]);
}
/* Unit conversion if necessary */
const double factor =
......
......@@ -183,14 +183,19 @@ void writeArray(hid_t grp, char* fileName, FILE* xmfFile,
/* Copy particle data to temporary buffer */
if (props.convert_part == NULL &&
props.convert_gpart == NULL) { /* No conversion */
char* temp_c = temp;
for (size_t i = 0; i < N; ++i)
memcpy(&temp_c[i * copySize], props.field + i * props.partSize, copySize);
} else if (props.convert_part != NULL) { /* conversion (for parts)*/
float* temp_f = temp;
for (size_t i = 0; i < N; ++i)
temp_f[i] = props.convert_part(&props.parts[i]);
} else if (props.convert_part != NULL) { /* conversion (for gparts)*/
} else if (props.convert_gpart != NULL) { /* conversion (for gparts)*/
float* temp_f = temp;
for (size_t i = 0; i < N; ++i)
temp_f[i] = props.convert_gpart(&props.gparts[i]);
......
Supports Markdown
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