PyMFEM
PyMFEM copied to clipboard
First element read by GF is 0 not the value in the file
When reading the mesh and GF attached, the first element gets a value of 0, not 1. When I write the GF back out, there is a difference between the files
mesh = mfem.Mesh(meshfile)
attr = mfem.GridFunction(mesh, attributefile)
attr.Load(self.attributefile, mesh.GetNE())
maxAttr = attr.Max()
logging.info(f"MAX ATTRIBUTE: {maxAttr}")
attr.Save("junk.gf")
@jtristano, may I ask how you generate self.attributefile? Note that GridFunction does not implement its own Load method. It simply inherits mfem::Vector::Load. Thus, I suspect the right way is to use Print (not Save) to create a file. Then, because of the same reason, mfem::Vector::Print is called.
If I dont call Save, I dont get the header for GF
Print just dumps a raw file. Why does this work for a solution but not a const fec?
FiniteElementSpace
FiniteElementCollection: Const3D
VDim: 1
Ordering: 0
Which then means I cannot generate the correct FESpace, correct?
I have the input files attached. There is no 0 attribute elements in the attached attr file