added resizing for vector vtk output

This commit is contained in:
hnil 2023-04-19 22:39:28 +02:00
parent c1bb0b0e09
commit e4b1a2eda7

View File

@ -83,7 +83,7 @@ class BaseOutputModule
enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
enum { dim = GridView::dimension };
enum { dimWorld = GridView::dimensionworld };
using Vector = BaseOutputWriter::Vector;
using Tensor = BaseOutputWriter::Tensor;
public:
@ -196,6 +196,25 @@ protected:
std::fill(buffer.begin(), buffer.end(), nullMatrix);
}
void resizeVectorBuffer_(VectorBuffer& buffer,
BufferType bufferType = DofBuffer)
{
size_t n;
if (bufferType == VertexBuffer)
n = static_cast<size_t>(simulator_.gridView().size(dim));
else if (bufferType == ElementBuffer)
n = static_cast<size_t>(simulator_.gridView().size(0));
else if (bufferType == DofBuffer)
n = simulator_.model().numGridDof();
else
throw std::logic_error("bufferType must be one of Dof, Vertex or Element");
buffer.resize(n);
Vector zerovector(dimWorld,0.0);
zerovector = 0.0;
std::fill(buffer.begin(), buffer.end(), zerovector);
}
/*!
* \brief Allocate the space for a buffer storing a equation specific
* quantity