From 45c916dac55bcee4b8a09d7603828fbcfcc229fa Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 17 Mar 2025 12:29:45 -0400 Subject: [PATCH 1/8] ci(hooks/formatHeader): script to auto format file headers added --- commit-config/hooks/READEME.md | 42 ++++++++ commit-config/hooks/formatHeader.py | 149 ++++++++++++++++++++++++++++ 2 files changed, 191 insertions(+) create mode 100644 commit-config/hooks/READEME.md create mode 100755 commit-config/hooks/formatHeader.py diff --git a/commit-config/hooks/READEME.md b/commit-config/hooks/READEME.md new file mode 100644 index 0000000..7eca776 --- /dev/null +++ b/commit-config/hooks/READEME.md @@ -0,0 +1,42 @@ +# Hook for adding and maintaing file headers automatically +All 4DSSE files should have a header specifying authors, last edits, copyright, and liscence information. + +Hook should be setup automatically to run on each commit. + +## Dependencies + +- GitPython +- Python (>=3.10) + +## Usage +This script assumes that an enviromental variable has been set which points to the root of the 4DSSE project. This is used to retreive the git log so that author information and last update date information may be read. By default this uses the enviromental variable `_4DSSE_ROOT`; however, this may be changed with the `--root` command line flag. Whatever is set as `--root` will be the name of the enviromental variable this script will search for. + +General usage might look like +```bash +python formatHeader.py ../../src/meshIO/private/meshIO.cpp +``` + +This will automatically add the following (or similar...) header to the file + +``` +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 16, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ +``` diff --git a/commit-config/hooks/formatHeader.py b/commit-config/hooks/formatHeader.py new file mode 100755 index 0000000..8c303f9 --- /dev/null +++ b/commit-config/hooks/formatHeader.py @@ -0,0 +1,149 @@ +from git import Repo +import datetime +import os +import re +from typing import Tuple +import sys + +REDCOLOR = "\033[1;31m" +GREENCOLOR = "\033[1;32m" +YELLOWCOLOR = "\033[1;33m" +BLUECOLOR = "\033[1;34m" +RESETCOLOR = "\033[0m" + +HEADER_PATTERN = re.compile(r"^.*\*{71}.*$(?:\n.*)*?^.*\*{71}.*\n", re.MULTILINE) + + +def get_source_dir(envVar): + sd = os.environ.get(envVar, None) + if sd is None: + print(f"{REDCOLOR}ERROR! Enviromental variable {envVar} is not set. Perhapse you forgot to set it in your shell profile?{RESETCOLOR}") + exit(1) + return sd + +def get_git_log(repoPath, filePath): + """ + Retrieves the git commit history for a specific file. + + :param repoPath: Path to the Git repository + :param filePath: Path to the file relative to the repo root + :return: List of commit messages with commit hashes + """ + repo = Repo(repoPath) + commits = list(repo.iter_commits(paths=filePath)) # Get commits affecting the file + + logEntries = [] + for commit in commits: + logEntries.append(f"{commit.hexsha[:7]} - {commit.author.name} - {commit.committed_date}") + + return logEntries + +def get_all_file_authors(logEntries): + """ + Retrieves the authors of the commits in a list of log entries. + + :param logEntries: List of log entries + :return: List of authors + """ + authors = [] + for entry in logEntries: + authors.append(entry.split(" - ")[1]) + return set(authors) + +def get_last_modification_date(logEntries): + """ + Retrieves the last modification date of the file. + + :param logEntries: List of log entries + :return: Last modification date + """ + return datetime.datetime.fromtimestamp(int(logEntries[0].split(" - ")[2])) + +def select_comment_chars(filename) -> Tuple[str, str, str]: + fileExtension = filename.split(".")[-1] + #switch statement based on file extension + match fileExtension: + case "py": + return ("\"\"\"", "\"\"\"", "#") + case "c" | "cpp" | "h" | "hpp": + return ("/*", "*/", "//") + case "f90" | "f": + return ("!", "!", "!") + case "sh": + return ("#", "#", "#") + case "cmake": + return ("#", "#", "#") + case "build": + return ("#", "#", "#") + case _: + return ("#", "", "#") + +def make_header(authors, date, filename, projectName): + authorSuffix = "s" if len(authors) > 1 else "" + authorsString = ', '.join(authors) + bs, be, c = select_comment_chars(filename) + + defaultHeader = f"""{bs} *********************************************************************** +{c} +{c} Copyright (C) {date.year} -- The 4D-STAR Collaboration +{c} File Author{authorSuffix}: {authorsString} +{c} Last Modified: {date.date().strftime("%B %d, %Y")} +{c} +{c} {projectName} is free software; you can use it and/or modify +{c} it under the terms and restrictions the GNU General Library Public +{c} License version 3 (GPLv3) as published by the Free Software Foundation. +{c} +{c} {projectName} is distributed in the hope that it will be useful, +{c} but WITHOUT ANY WARRANTY; without even the implied warranty of +{c} MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +{c} See the GNU Library General Public License for more details. +{c} +{c} You should have received a copy of the GNU Library General Public License +{c} along with this software; if not, write to the Free Software +{c} Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +{c} +{c} *********************************************************************** {be}\n""" + + return defaultHeader + +if __name__ == "__main__": + # Ensure python version at least 3.10 + if sys.version_info < (3, 10): + print(f"{REDCOLOR}ERROR! Python version 3.10 or higher is required{RESETCOLOR}") + + import argparse + + parser = argparse.ArgumentParser(description="Format the header of a file") + parser.add_argument("file", type=str, help="The file to format") + parser.add_argument("--root", type=str, default="_4DSSE_ROOT", help="The name of the environmental variable that points to the root of the project") + parser.add_argument("--project", type=str, default="4DSSE", help="The name of the project") + args = parser.parse_args() + + absPath = os.path.abspath(args.file) + + assert os.path.exists(absPath), f"{REDCOLOR}ERROR! The file {absPath} does not exist{RESETCOLOR}" + + sd = get_source_dir(args.root) + if not absPath.startswith(sd): + print(f"{REDCOLOR}ERROR! The file {absPath} is not in the source directory {sd}{RESETCOLOR}") + exit(1) + + logEntry = get_git_log(sd, absPath) + authors = get_all_file_authors(logEntry) + + lastModificationDate = get_last_modification_date(logEntry) + header = make_header(authors, lastModificationDate, args.file, args.project) + + headerNumLines = header.count("\n") + # check if the first lines of the file are the header + with open(args.file, "r") as f: + # Add the header to the file + with open(args.file, "r") as f: + fileContent = f.read() + + # remove any old version of the header + fileContent = HEADER_PATTERN.sub("", fileContent) + + with open(args.file, "w") as f: + f.write(header) + f.write(fileContent) From e9baec63d993dce1d3145174235e289015acc0d0 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 17 Mar 2025 12:42:20 -0400 Subject: [PATCH 2/8] ci(utils/fileHeaders): added one time run script to generate file headers --- utils/fileHeaders/run_format_headers.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 utils/fileHeaders/run_format_headers.py diff --git a/utils/fileHeaders/run_format_headers.py b/utils/fileHeaders/run_format_headers.py new file mode 100755 index 0000000..b4100f2 --- /dev/null +++ b/utils/fileHeaders/run_format_headers.py @@ -0,0 +1,17 @@ +import pathlib +import os +import subprocess + +def run_format_headers(): + root = "../../src" + script = "../../commit-config/hooks/formatHeader.py" + + validExtensions = [".c", ".h", ".cpp", ".hpp", ".py", ".f", ".f90"] + + for path in pathlib.Path(root).rglob("*"): + if path.is_file() and path.suffix in validExtensions: + print(f"Adding header to: {path}") + subprocess.run(["python", script, str(path)], stdout=subprocess.PIPE) + +if __name__ == "__main__": + run_format_headers() \ No newline at end of file From 3f86d0ceb1264ab807fc285c1f0c5588cc4d0c03 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 17 Mar 2025 12:42:33 -0400 Subject: [PATCH 3/8] docs(src): added file headers to all files --- src/config/private/config.cpp | 20 ++++++++++++++++++++ src/config/public/config.h | 20 ++++++++++++++++++++ src/const/private/const.cpp | 20 ++++++++++++++++++++ src/const/public/const.h | 20 ++++++++++++++++++++ src/dobj/private/DObject.cpp | 20 ++++++++++++++++++++ src/dobj/private/LockableDObject.cpp | 20 ++++++++++++++++++++ src/dobj/private/Metadata.cpp | 20 ++++++++++++++++++++ src/dobj/public/DObject.h | 20 ++++++++++++++++++++ src/dobj/public/LockableDObject.h | 20 ++++++++++++++++++++ src/dobj/public/Metadata.h | 20 ++++++++++++++++++++ src/eos/private/helm.cpp | 20 ++++++++++++++++++++ src/eos/public/helm.h | 20 ++++++++++++++++++++ src/meshIO/private/meshIO.cpp | 20 ++++++++++++++++++++ src/meshIO/public/meshIO.h | 20 ++++++++++++++++++++ src/opac/public/opac.h | 20 ++++++++++++++++++++ src/opatIO/private/opatIO.cpp | 20 ++++++++++++++++++++ src/opatIO/public/opatIO.h | 20 ++++++++++++++++++++ src/poly/coeff/private/polyCoeff.cpp | 20 ++++++++++++++++++++ src/poly/coeff/public/polyCoeff.h | 20 ++++++++++++++++++++ src/poly/utils/private/polyIO.cpp | 20 ++++++++++++++++++++ src/poly/utils/private/polyMFEMUtils.cpp | 20 ++++++++++++++++++++ src/poly/utils/public/polyIO.h | 20 ++++++++++++++++++++ src/poly/utils/public/polyMFEMUtils.h | 20 ++++++++++++++++++++ src/probe/private/probe.cpp | 20 ++++++++++++++++++++ src/probe/public/probe.h | 20 ++++++++++++++++++++ 25 files changed, 500 insertions(+) diff --git a/src/config/private/config.cpp b/src/config/private/config.cpp index 5eb3af6..ffce7a3 100644 --- a/src/config/private/config.cpp +++ b/src/config/private/config.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 21, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include #include #include diff --git a/src/config/public/config.h b/src/config/public/config.h index 9770eae..e8b96a0 100644 --- a/src/config/public/config.h +++ b/src/config/public/config.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 20, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #ifndef CONFIG_H #define CONFIG_H diff --git a/src/const/private/const.cpp b/src/const/private/const.cpp index 08cafde..474f4cc 100644 --- a/src/const/private/const.cpp +++ b/src/const/private/const.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 12, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include #include #include diff --git a/src/const/public/const.h b/src/const/public/const.h index c98ecc0..419382c 100644 --- a/src/const/public/const.h +++ b/src/const/public/const.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: March 05, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #ifndef CONST_H #define CONST_H diff --git a/src/dobj/private/DObject.cpp b/src/dobj/private/DObject.cpp index 0ce0bed..1d5e062 100644 --- a/src/dobj/private/DObject.cpp +++ b/src/dobj/private/DObject.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 04, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include "DObject.h" #include #include diff --git a/src/dobj/private/LockableDObject.cpp b/src/dobj/private/LockableDObject.cpp index 65b8cf9..0ad6cb6 100644 --- a/src/dobj/private/LockableDObject.cpp +++ b/src/dobj/private/LockableDObject.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: January 19, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include "LockableDObject.h" /** diff --git a/src/dobj/private/Metadata.cpp b/src/dobj/private/Metadata.cpp index 12d1bbd..a3aeabd 100644 --- a/src/dobj/private/Metadata.cpp +++ b/src/dobj/private/Metadata.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: January 19, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include "Metadata.h" /** diff --git a/src/dobj/public/DObject.h b/src/dobj/public/DObject.h index 4261610..3ef0e1a 100644 --- a/src/dobj/public/DObject.h +++ b/src/dobj/public/DObject.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 04, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #ifndef DOBJECT_H #define DOBJECT_H diff --git a/src/dobj/public/LockableDObject.h b/src/dobj/public/LockableDObject.h index 60790eb..05a445c 100644 --- a/src/dobj/public/LockableDObject.h +++ b/src/dobj/public/LockableDObject.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: January 19, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #ifndef LOCKABLE_DOBJECT_H #define LOCKABLE_DOBJECT_H diff --git a/src/dobj/public/Metadata.h b/src/dobj/public/Metadata.h index 11696ad..a122dc6 100644 --- a/src/dobj/public/Metadata.h +++ b/src/dobj/public/Metadata.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: January 22, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #ifndef METADATA_H #define METADATA_H diff --git a/src/eos/private/helm.cpp b/src/eos/private/helm.cpp index 0fe2c01..f80a8b3 100644 --- a/src/eos/private/helm.cpp +++ b/src/eos/private/helm.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: March 13, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ // this file contains a C++ conversion of Frank Timmes' fortran code // helmholtz.f90, which implements the Helmholtz Free Energy EOS described // by Timmes & Swesty (2000) doi:10.1086/313304 -- Aaron Dotter 2025 diff --git a/src/eos/public/helm.h b/src/eos/public/helm.h index 5c3c90c..bdbfdad 100644 --- a/src/eos/public/helm.h +++ b/src/eos/public/helm.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Authors: Aaron Dotter, Emily Boudreaux +// Last Modified: March 06, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ // this file contains a C++ conversion of Frank Timmes' fortran code // helmholtz.f90, which implements the Helmholtz Free Energy EOS described // by Timmes & Swesty (2000) doi:10.1086/313304 -- Aaron Dotter 2025 diff --git a/src/meshIO/private/meshIO.cpp b/src/meshIO/private/meshIO.cpp index 8674af3..01619bb 100644 --- a/src/meshIO/private/meshIO.cpp +++ b/src/meshIO/private/meshIO.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 16, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include "mfem.hpp" #include #include diff --git a/src/meshIO/public/meshIO.h b/src/meshIO/public/meshIO.h index 5975801..aad8bf7 100644 --- a/src/meshIO/public/meshIO.h +++ b/src/meshIO/public/meshIO.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 16, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #ifndef MESHIO_H #define MESHIO_H diff --git a/src/opac/public/opac.h b/src/opac/public/opac.h index 3d71c2c..6359f01 100644 --- a/src/opac/public/opac.h +++ b/src/opac/public/opac.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 04, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #ifndef OPAC_H #define OPAC_H diff --git a/src/opatIO/private/opatIO.cpp b/src/opatIO/private/opatIO.cpp index 6ae7f37..43960f5 100644 --- a/src/opatIO/private/opatIO.cpp +++ b/src/opatIO/private/opatIO.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: March 07, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include "opatIO.h" #include #include diff --git a/src/opatIO/public/opatIO.h b/src/opatIO/public/opatIO.h index 1e816d4..f822420 100644 --- a/src/opatIO/public/opatIO.h +++ b/src/opatIO/public/opatIO.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: March 07, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #ifndef OPATIO_H #define OPATIO_H diff --git a/src/poly/coeff/private/polyCoeff.cpp b/src/poly/coeff/private/polyCoeff.cpp index c4076a0..36a5ab9 100644 --- a/src/poly/coeff/private/polyCoeff.cpp +++ b/src/poly/coeff/private/polyCoeff.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 14, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include "mfem.hpp" #include diff --git a/src/poly/coeff/public/polyCoeff.h b/src/poly/coeff/public/polyCoeff.h index 46204f1..240b6af 100644 --- a/src/poly/coeff/public/polyCoeff.h +++ b/src/poly/coeff/public/polyCoeff.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 12, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include "mfem.hpp" #include diff --git a/src/poly/utils/private/polyIO.cpp b/src/poly/utils/private/polyIO.cpp index d540cb0..007cda8 100644 --- a/src/poly/utils/private/polyIO.cpp +++ b/src/poly/utils/private/polyIO.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 14, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include "mfem.hpp" #include #include diff --git a/src/poly/utils/private/polyMFEMUtils.cpp b/src/poly/utils/private/polyMFEMUtils.cpp index 781efab..65636e2 100644 --- a/src/poly/utils/private/polyMFEMUtils.cpp +++ b/src/poly/utils/private/polyMFEMUtils.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 12, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include "mfem.hpp" #include #include diff --git a/src/poly/utils/public/polyIO.h b/src/poly/utils/public/polyIO.h index 9ca7ceb..acf2237 100644 --- a/src/poly/utils/public/polyIO.h +++ b/src/poly/utils/public/polyIO.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 14, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #ifndef POLY_IO_H #define POLY_IO_H diff --git a/src/poly/utils/public/polyMFEMUtils.h b/src/poly/utils/public/polyMFEMUtils.h index ac07264..d48a78d 100644 --- a/src/poly/utils/public/polyMFEMUtils.h +++ b/src/poly/utils/public/polyMFEMUtils.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 14, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include "mfem.hpp" #include diff --git a/src/probe/private/probe.cpp b/src/probe/private/probe.cpp index 6d26f66..8ae8f11 100644 --- a/src/probe/private/probe.cpp +++ b/src/probe/private/probe.cpp @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 23, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ #include "quill/Backend.h" #include "quill/Frontend.h" #include "quill/Logger.h" diff --git a/src/probe/public/probe.h b/src/probe/public/probe.h index 1ef7e09..ce863d0 100644 --- a/src/probe/public/probe.h +++ b/src/probe/public/probe.h @@ -1,3 +1,23 @@ +/* *********************************************************************** +// +// Copyright (C) 2025 -- The 4D-STAR Collaboration +// File Author: Emily Boudreaux +// Last Modified: February 23, 2025 +// +// 4DSSE is free software; you can use it and/or modify +// it under the terms and restrictions the GNU General Library Public +// License version 3 (GPLv3) as published by the Free Software Foundation. +// +// 4DSSE is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public License +// along with this software; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// *********************************************************************** */ //=== Probe.h === #ifndef PROBE_H #define PROBE_H From 8fb63bf6914ff7be03f350f0dd2464fe31cfdb23 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 17 Mar 2025 12:44:29 -0400 Subject: [PATCH 4/8] build(mfem): brought proper meson patch changes forward from polytrope --- build-config/mfem/meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/build-config/mfem/meson.build b/build-config/mfem/meson.build index ff60430..a642f0e 100644 --- a/build-config/mfem/meson.build +++ b/build-config/mfem/meson.build @@ -1,5 +1,3 @@ -patchFile = files('disable_mfem_selfcheck.patch') - mfem_cmake_options = cmake.subproject_options() mfem_cmake_options.add_cmake_defines({ 'MFEM_ENABLE_EXAMPLES': 'OFF', From a2268c0b54e9a890d244c52c1a0fe1f92a32816f Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 17 Mar 2025 12:44:55 -0400 Subject: [PATCH 5/8] docs(hooks/formatHeader): updated readme --- commit-config/hooks/READEME.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commit-config/hooks/READEME.md b/commit-config/hooks/READEME.md index 7eca776..cac0612 100644 --- a/commit-config/hooks/READEME.md +++ b/commit-config/hooks/READEME.md @@ -40,3 +40,9 @@ This will automatically add the following (or similar...) header to the file // // *********************************************************************** */ ``` + +The project name may be changed with the `--project` command line argument. `--project` defaults to "4DSSE" + +## Notes +- Generally this script is **not** meant to be directly invoked. Rather, it is meant to be run as a pre-commit-hook automatically. +- There are defaults for root and project; however, they can be configured with command line options so if they change with time those changes can be easily propegated to this script. From d764c5e2b639ee1cb74c26a44b48f7a944f50cd5 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 17 Mar 2025 12:52:31 -0400 Subject: [PATCH 6/8] docs(utils/readme): added readme --- utils/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 utils/README.md diff --git a/utils/README.md b/utils/README.md new file mode 100644 index 0000000..fb27655 --- /dev/null +++ b/utils/README.md @@ -0,0 +1,17 @@ +# 4DSSE Utils +A collection of utilities useful for 4DSSE. Each utiliy is intended to be more-or-less standalone and easy to use. These are not directly physics related; rather, these are implimentation and deevlopment related. + +# NOTE +**You likeley to not need to be here unless you are a 4D-STAR developer or are diving pretty deeply into 4D-STAR** + +## Utilities +- defaultConfig + - A tool to generate a default config file based on the config varaiables used in the source. This is useful to confirm that typos have not crept into the source code preventing config values from being read properly. +- fileHeaders + - A tool to generate / update all file headers for python, c, c++, and fortran files in the source tree. This can be run even if it has already been run and it will simply update the headers to reflect any new authors, and latest changes. +- meshGeneration + - A tool to generate the default, spherical, mesh used by 4DSSE in the gmsh 2.2 format. This mesh is guarenteed to have a vertex within machine precision of (0, 0, 0). +- opatio + - A installable python module for working with (creating, reading) OPAT files for use with 4DSSE opacity routines. + +Further details about each utility are included in that utilities sub-folder. \ No newline at end of file From 4d12b6beb21bf1a4e55195f04865be1a8511dbb4 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 17 Mar 2025 13:24:08 -0400 Subject: [PATCH 7/8] docs(helm): added header --- src/eos/private/helm.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/eos/private/helm.cpp b/src/eos/private/helm.cpp index f80a8b3..172d88c 100644 --- a/src/eos/private/helm.cpp +++ b/src/eos/private/helm.cpp @@ -2,7 +2,7 @@ // // Copyright (C) 2025 -- The 4D-STAR Collaboration // File Author: Emily Boudreaux -// Last Modified: March 13, 2025 +// Last Modified: March 17, 2025 // // 4DSSE is free software; you can use it and/or modify // it under the terms and restrictions the GNU General Library Public @@ -33,6 +33,7 @@ #include + #include "helm.h" #include "const.h" #include "probe.h" From 7568eb1a46f2f6beb2b00947b9b8ec0b3727b5ed Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Mon, 17 Mar 2025 13:31:54 -0400 Subject: [PATCH 8/8] ci(post-commit): updated to track post-commit --- commit-config/hooks/READEME.md | 12 ++++++++--- commit-config/hooks/install.sh | 19 +++++++++++++++++ commit-config/hooks/post-commit | 36 +++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100755 commit-config/hooks/install.sh create mode 100755 commit-config/hooks/post-commit diff --git a/commit-config/hooks/READEME.md b/commit-config/hooks/READEME.md index cac0612..068fa43 100644 --- a/commit-config/hooks/READEME.md +++ b/commit-config/hooks/READEME.md @@ -4,12 +4,18 @@ All 4DSSE files should have a header specifying authors, last edits, copyright, Hook should be setup automatically to run on each commit. ## Dependencies - - GitPython - Python (>=3.10) -## Usage -This script assumes that an enviromental variable has been set which points to the root of the 4DSSE project. This is used to retreive the git log so that author information and last update date information may be read. By default this uses the enviromental variable `_4DSSE_ROOT`; however, this may be changed with the `--root` command line flag. Whatever is set as `--root` will be the name of the enviromental variable this script will search for. +## Installation +Generally one is intended to use this by copying `post-commit` into the `.git/hooks` directory. This can be done simply by running the install script (note that the `_4DSEE_ROOT` enviromental variable **must** be set.) + +```bash +install.sh +``` + +## Manual Usage +The python script `formatHeader.py` assumes that an enviromental variable has been set which points to the root of the 4DSSE project. This is used to retreive the git log so that author information and last update date information may be read. By default this uses the enviromental variable `_4DSSE_ROOT`; however, this may be changed with the `--root` command line flag. Whatever is set as `--root` will be the name of the enviromental variable this script will search for. General usage might look like ```bash diff --git a/commit-config/hooks/install.sh b/commit-config/hooks/install.sh new file mode 100755 index 0000000..467205e --- /dev/null +++ b/commit-config/hooks/install.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +PROJECT_ROOT=$_4DSSE_ROOT +# Check if the project root is set +if [ -z "$PROJECT_ROOT" ]; then + echo "The 4DSSE root is not set. Please set the _4DSSE_ROOT environment variable." + exit 1 +fi + +cp $PROJECT_ROOT/commit-config/hooks/post-commit $PROJECT_ROOT/.git/hooks/post-commit + +# Make sure the post-commit hook is executable +chmod +x $PROJECT_ROOT/.git/hooks/post-commit + +# Check if the post-commit hook was copied successfully +if [ ! -f $PROJECT_ROOT/.git/hooks/post-commit ]; then + echo "ERROR! The post-commit hook was not copied successfully." + exit 1 +fi \ No newline at end of file diff --git a/commit-config/hooks/post-commit b/commit-config/hooks/post-commit new file mode 100755 index 0000000..24066e2 --- /dev/null +++ b/commit-config/hooks/post-commit @@ -0,0 +1,36 @@ +#!/bin/bash + +# Do not run the commit hook a second time when the headers have been added +if [[ "$SKIP_POST_COMMIT" == "1" ]]; then + exit 0 +fi + +# Define the formatter script +FORMATTER_SCRIPT="python ./commit-config/hooks/formatHeader.py" + +# File extensions to match +EXTENSIONS="py|h|hpp|c|cpp|f|f90|build" + +# Find all matching files in src which are currently staged +files=$(git diff --name-only HEAD^ | grep -E '\.('"$EXTENSIONS"')$') + +# Check if any files were found +if [ -z "$files" ]; then + echo "No matching files found." + exit 0 +fi + +# Run the formatter on each file +for file in $files; do + echo "Updating header for: $file" + $FORMATTER_SCRIPT "$file" +done + +# # Automatically stage the updated files +# git add $files + +# # Optionally, commit the updated files (creates a second commit) +# SKIP_POST_COMMIT=1 git commit -m "(docs/headers) Update headers after commit" || echo "No changes to commit" + +echo "Post-commit hook executed." +