Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First element read by GF is 0 not the value in the file #201

Open
jtristano opened this issue Nov 27, 2023 · 4 comments
Open

First element read by GF is 0 not the value in the file #201

jtristano opened this issue Nov 27, 2023 · 4 comments

Comments

@jtristano
Copy link

jtristano commented Nov 27, 2023

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
Copy link
Author

@sshiraiwa
Copy link
Member

@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.

@jtristano
Copy link
Author

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?

@jtristano
Copy link
Author

I have the input files attached. There is no 0 attribute elements in the attached attr file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants