refactor(header): brought auto header changes from main into polytrope branch
This commit is contained in:
54
commit-config/hooks/README.md
Normal file
54
commit-config/hooks/README.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# 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)
|
||||
|
||||
## 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
|
||||
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
|
||||
//
|
||||
// *********************************************************************** */
|
||||
```
|
||||
|
||||
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.
|
||||
149
commit-config/hooks/formatHeader.py
Executable file
149
commit-config/hooks/formatHeader.py
Executable file
@@ -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)
|
||||
19
commit-config/hooks/install.sh
Executable file
19
commit-config/hooks/install.sh
Executable file
@@ -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
|
||||
36
commit-config/hooks/post-commit
Executable file
36
commit-config/hooks/post-commit
Executable file
@@ -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."
|
||||
|
||||
@@ -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 <string>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 <iostream>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -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"
|
||||
|
||||
/**
|
||||
|
||||
@@ -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"
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/* ***********************************************************************
|
||||
//
|
||||
// Copyright (C) 2025 -- The 4D-STAR Collaboration
|
||||
// File Author: Emily Boudreaux
|
||||
// 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
|
||||
// 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
|
||||
@@ -13,6 +33,7 @@
|
||||
#include <cerrno>
|
||||
|
||||
|
||||
|
||||
#include "helm.h"
|
||||
#include "const.h"
|
||||
#include "probe.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
|
||||
|
||||
@@ -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 <string>
|
||||
#include <iostream>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 <fstream>
|
||||
#include <iostream>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 <cmath>
|
||||
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/* ***********************************************************************
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// *********************************************************************** */
|
||||
|
||||
#ifndef POLYCOEFF_H
|
||||
#define POLYCOEFF_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 <string>
|
||||
#include <fstream>
|
||||
|
||||
@@ -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 <string>
|
||||
#include <iostream>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 POLYMFEMUTILS_H
|
||||
#define POLYMFEMUTILS_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
|
||||
//
|
||||
// *********************************************************************** */
|
||||
#include "quill/Backend.h"
|
||||
#include "quill/Frontend.h"
|
||||
#include "quill/Logger.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
|
||||
|
||||
17
utils/README.md
Normal file
17
utils/README.md
Normal file
@@ -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.
|
||||
17
utils/fileHeaders/run_format_headers.py
Executable file
17
utils/fileHeaders/run_format_headers.py
Executable file
@@ -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()
|
||||
Reference in New Issue
Block a user