Repository navigation
Retire XDMF from the archive: the writers build ymf grid dicts, no module imports xml (C2) - #97
Merged
Merged
Conversation
…dule imports xml (C2) The running archive is Archiver.ArchiveDomain, named collections each holding the current step's ymf grid dict, in place of the ElementTree whose last child was that step. write_grid starts a step's grid and records its time on the collection; write_topology, write_geometry and write_field fill it with ymf's own builders. allGatherIncremental stores the dicts as they are: the parse_grid_element bridge is gone. Every writer is converted: the fourteen writeMeshXdmf_* methods and the hand-built function writers in XdmfWriter, Mesh/Mesh2DM/Mesh3DM in MeshTools (base mesh, element-boundary mesh, local-to-global maps, material types), AuxiliaryVariables.writeScalarXdmf. Dataset and sidecar names are unchanged. self.tree, indentXML and the xml imports are gone; NumericalSolution no longer creates a <Domain>. The legacy readers in MeshTools read the archive's .h5 metadata through readArchiveDomain (version 1 and 2 alike), so no .xmf is needed; findXMLgridElement became findArchiveGrid on the domain dict. The two XDMF reads a version 1 archive still needs live in ymf.xdmf (ymf#20): read_grid_fragment for the stored <Grid> fragments and collection_names for the order of the collections. Four global_sync writers that only worked on one rank now contribute the owned slice with offsets like the rest (MonomialDGPK and LowestOrderMixed vectors, P1Bubble scalar and vector); writeMeshXdmf_DGP0's mixed topology and readMixedElementTopologyFromXdmf read a self.xdmf_topology that did not exist. CouplingFSI.pyx, which writes its own per-body .xmf, keeps a local copy of indentXML. test_archive_no_xml.py pins by AST that no module on the archive path imports an XML library and that no SubElement is left in the package; test_archiver_write_field.py pins the dicts and the builders. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…FromArchive reads a proteus archive The OpenFOAM-converted fixture hex_cube_3x3 is an .xmf whose .h5 holds the arrays and no proteus metadata, so it cannot be read from the .h5 alone. readMeshXdmf keeps reading such files, parsed by ymf.xdmf rather than by proteus; readMeshFromArchive is the reader for a proteus archive. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
C2: retire XDMF/XML from proteus
Only
ymf2xmfneeds XDMF now. The archive's writers build ymf grid dicts directly; nothing in theproteuspackage imports an XML library.Needs cekees/ymf#20 merged first (CI installs ymf from
@main): the two XDMF reads a version 1 archive still needs moved there.What changed
Archiver.ArchiveDomainholds namedArchiveCollections, each with only the current step's ymf grid dict (the tree used to be emptied at every sync too).write_gridstarts a step's grid and records its time on the collection;write_topology,write_geometryandwrite_fieldfill it with ymf's own builders and return the data item.allGatherIncrementalstores the dicts as they are, so theparse_grid_elementbridge is gone, and the stored step time is the float, not a%estring.writeMeshXdmf_*and the hand-built function writers inArchiver.XdmfWriter;Mesh,Mesh2DMandMesh3DM.writeMeshXdmfin MeshTools (the base mesh, its element-boundary mesh, the local-to-global maps and the material types);AuxiliaryVariables.writeScalarXdmf(the value is inlined in the document). Dataset names and sidecar names are unchanged, so existing archives read as before. The "does this time already have a grid?" test every writer made against its grid's<Time>is nowcollection.is_current(t).self.tree,indentXML,from xml.etree.ElementTree import *in Archiver, AuxiliaryVariables and MeshTools, and the two lines in NumericalSolution that created the<Domain>.MeshTools.readMeshFromArchivereads a proteus archive from its.h5metadata throughreadArchiveDomain(version 1 and 2 alike, no.xmfneeded), andreadMeshXdmfreads XDMF written by other tools (the OpenFOAMhex_cube_3x3fixture) throughymf.xdmf.read_xdmf;findXMLgridElementbecamefindArchiveGrid. The v1 fragments and the v1 collection order are parsed byymf.xdmf.read_grid_fragmentandymf.xdmf.collection_names.test_archiver_write_field.pypins the dicts instead of the XML (and the builders);test_archive_no_xml.pychecks by AST that no module on the archive path importsxmland that noSubElementis left in the package; the read-path, dtype, parallel-metadata and bathymetry tests lost their tree fixtures.Fixed along the way
Four writers only ever worked on one rank under
global_syncand now contribute the owned slice with offsets like the rest:writeVectorFunctionXdmf_MonomialDGPK,writeVectorFunctionXdmf_LowestOrderMixed(wrote the whole local array under the global name with a non-collective create),writeVectorFunctionXdmf_P1Bubble(zero components sized by the global count against owned slices),writeFunctionXdmf_P1Bubble(offsets read off the subdomain mesh).writeMeshXdmf_DGP0declared a mixed topology's size fromself.xdmf_topology, which does not exist on the writer;readMixedElementTopologyFromXdmfhad the sameself.in a module function.writeMeshXdmf_MonomialDGPKand_LowestOrderMixednow setself.mesh, which their vector writers read.Left as it was
mbd/CouplingFSI.pyxstill writes its own per-body.xmf(version 1 style fragments in its own.h5) and keeps a local copy ofindentXML; converting it to the archive is a follow-up.scripts/waves2xmfandvelocity2xmfare Python 2 and were already dead;scripts/gatherArchives.pycomposes.xmffiles and stays an XDMF tool.🤖 Generated with Claude Code