Commit f3b0a367 authored by Richard Angersbach's avatar Richard Angersbach
Browse files

Allow canonical storage of face-centered fields when printing xdmf files.

parent b60e0dcb
......@@ -50,7 +50,7 @@ abstract class IR_PrintXdmfStructured(ioMethod : IR_Expression) extends IR_Print
}
val tmpBufStag : Option[IR_IV_TemporaryBuffer] = if (staggerDim >= 0) {
val dims = ListBuffer[IR_Expression](numCells_x, numCells_y, numCells_z).take(numDimsGrid)
Some(IR_IV_TemporaryBuffer(field.resolveBaseDatatype, IR_AtCellCenter, "tmp_" + field.name, domainIndex, blockwise = true, dims))
Some(IR_IV_TemporaryBuffer(field.resolveBaseDatatype, IR_AtCellCenter, IR_FileAccess.declareVariable(s"tmp_${field.codeName}"), domainIndex, blockwise = !canonicalFileLayout, dims))
} else {
None
}
......@@ -60,10 +60,7 @@ abstract class IR_PrintXdmfStructured(ioMethod : IR_Expression) extends IR_Print
IR_DataBuffer(field, slot, includeGhostLayers, None, Some(dataset), canonicalFileLayout)
} else {
// face-centered variable -> pass temp. buffer with interp. values
if (canonicalFileLayout) {
Logger.warn("Unable to use IR_PrintXdmfField with \"canonicalOrder = true\" for face-centered variables. Flag is ignored.")
}
IR_DataBuffer(tmpBufStag.get, slot, None, Some(dataset))
IR_DataBuffer(tmpBufStag.get, slot, None, Some(dataset), canonicalFileLayout)
}
override def stmtsForPreparation : ListBuffer[IR_Statement] = {
......@@ -125,12 +122,14 @@ abstract class IR_PrintXdmfStructured(ioMethod : IR_Expression) extends IR_Print
IR_ExpressionIndex((0 until numDimsGrid).toArray.map(dim => dataBuffer.beginIndices(dim) - dataBuffer.referenceOffset(dim) : IR_Expression)),
IR_ExpressionIndex((0 until numDimsGrid).toArray.map(dim => dataBuffer.endIndices(dim) - dataBuffer.referenceOffset(dim) : IR_Expression)))
val fragOff = if (tmpBufDest.blockwise) IR_LoopOverFragments.defIt * numCellsPerFrag else IR_IntegerConstant(0)
val linearizedIdx = idxRange.linearizeIndex(IR_LoopOverDimensions.defIt(numDimsGrid))
stmts += IR_LoopOverFragments(
IR_IfCondition(IR_IV_IsValidForDomain(dataBuffer.domainIdx),
IR_LoopOverDimensions(numDimsGrid, idxRange,
IR_Assignment(
IR_IV_TemporaryBuffer.accessArray(tmpBufDest, IR_LoopOverFragments.defIt * numCellsPerFrag + linearizedIdx),
IR_IV_TemporaryBuffer.accessArray(tmpBufDest, fragOff + linearizedIdx),
mean))))
stmts
......
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