You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.
Upstream in Firedrake we hook in to the PETSc citations mechanism so that someone can run a simulation and add the PETSc option -citations to show.
It would be nice if FIAT registered citations for all its elements (and possibly the fiat-related paper describing their implementation if required) so that people can know what to cite.
We don't want a hard PETSc dependency in FIAT, so how about something like this (see also some discussion in FInAT/FInAT#71), which a downstream consumer can hook up to PETSc (or otherwise just use).
classCitations(dict):
"""Entry point to citations management. This object may be used to record Bibtex citation information and then register that a particular citation is relevant for a particular computation. Example usage:: from FIAT.citations import registry registry["key"] = "bibtex-entry-for-my-funky-method" ... if using_funky_method: registry.register("key") ... registry.bibtex(filename) """def__init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._registered=set()
def__setitem__(self, key, entry):
"""Add a paper to the database of possible citations. :arg key: The key to use. :arg entry: The bibtex entry. """ifkeyinselfandentry!=self[key]:
raiseValueError("Adding duplicate key with different entry.")
super().__setitem__(key, entry)
defregister(self, key):
"""Register that a paper has been used in this computation. :arg key: The key of the relevant citation. :raises KeyError: if no such citation is found in the database. Papers to be cited can be added using :meth:`add`. .. note:: The intended use is that :meth:`register` should be called only when the referenced functionality is actually being used. """cite=self.get(key, None)
ifciteisNone:
raiseKeyError(f"Did not find a citation for '{key}', did you forget to add it?")
self._registered.add(key)
defbibtex(self):
"""Produce bibtex of currently registered citations. :returns: String."""return"\n".join(self[key] forkeyinsorted(self._registered))
registry=Citations()
The text was updated successfully, but these errors were encountered:
Upstream in Firedrake we hook in to the PETSc citations mechanism so that someone can run a simulation and add the PETSc option
-citations
to show.It would be nice if FIAT registered citations for all its elements (and possibly the fiat-related paper describing their implementation if required) so that people can know what to cite.
We don't want a hard PETSc dependency in FIAT, so how about something like this (see also some discussion in FInAT/FInAT#71), which a downstream consumer can hook up to PETSc (or otherwise just use).
The text was updated successfully, but these errors were encountered: