added resizing for vector vtk output

This commit is contained in:
hnil committed 2023-06-01 12:20:30 +02:00
1 parent c1bb0b0e09
commit e4b1a2eda7
1 file changed
+20 -1
+20 -1
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