Skip to content

CPP MOLE 2.0 grid implementation + error handling - #442

Open
Tony-Drummond wants to merge 37 commits into
dev/MOLE_2.0from
cpp_dev/mole2_0_grid_implementation
Open

CPP MOLE 2.0 grid implementation + error handling#442
Tony-Drummond wants to merge 37 commits into
dev/MOLE_2.0from
cpp_dev/mole2_0_grid_implementation

Conversation

@Tony-Drummond

Copy link
Copy Markdown
Collaborator

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Example
  • Documentation

Description

Objective
Bring the C++ implementation into compliance with the MOLE 2.0
API, numerical behavior, testing, documentation, and packaging standards.

mole/
├── cpp/
| │── cmake/
| │── doc/
| │── examples
| |── src/
| │ ├── boundaries
| │ └── grids
| │ └── include
| │ └── operators
| │ └── sys
| │ └── utils
| |── tests
Figure 1. C++ MOLE 2.0 implementation. Bolded subdirectories names are the ones impacted by this PR and related Git issues.
This PR implements first steps of CPP MOLE 2.0 implementation:

  1. Adopt new CPP software organization into the directory structure in Figure 1 (below)
  2. Implement MOLE Errors handling and reporting system.
  3. Implement C++ regression tests for the MOLE Errors module and use examples for documentation
  4. Implement MOLE Grid classes and related data structures
  5. Implement C++ regression tests for the MOLE Grid classes + Error handling/tracking, and basic examples for documentation

Related Issues & Documents

Issues, #437 (cpp directory reorganization) , #438 (error handling), #440 (cpp grid implementation)

QA Instructions, Screenshots, Recordings

Tests and examples for creating grid are included. There are several tests of the full CPP functionality included here.

To build:

  1. cd mole/cpp (notice that while we are moving from MOLE 1.2 to MOLE 2.0, the new CPP development is organized using the directory structure shown above). Thus, to build the C++, start from the subdirectory mole/cpp
  2. mkdir build; cd build create a new subdirectory build and enter that new subdirectory
  3. cmake .. will prepare to build the MOLE cpp library and include all software dependencies
  4. make will manually build the MOLE library, examples and tests
  5. cd examples/grids to run different examples of grid creation, or
  6. cd tests to run any of the different tests of the library (>120 tests of the current C++ MOLE API)

Keep-open request

  • I am requesting maintainer review for keep-open.

Reason:

Added/updated tests?

_We encourage you to test all code included with MOLE, including examples.

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

Read Contributing Guide and Code of Conduct

[optional] Are there any post deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

valeriabarra and others added 24 commits August 11, 2026 21:42
Bumps [pillow](https://github.com/python-pillow/Pillow) from 12.1.1 to 12.3.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](python-pillow/Pillow@12.1.1...12.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-version: 12.3.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Fix version specification for Pillow in requirements.txt

Signed-off-by: Christopher Paolini <paolini@engineering.sdsu.edu>
Added debugging information to CMake configuration step.

Signed-off-by: Christopher Paolini <paolini@engineering.sdsu.edu>
New directory structure with new implementations for MOLE grids, arrays, errors, and utilities.  New README files in every subdirectory

fixed errors
Added debugging information to CMake configuration step.

Signed-off-by: Christopher Paolini <paolini@engineering.sdsu.edu>
New directory structure with new implementations for MOLE grids, arrays, errors, and utilities.  New README files in every subdirectory

fixed errors

grid basic struct

makegrid added

Including DEBUGING MODE

Adding testing and build utilities

CMakefiles are updated
Parses variadic <attribute, value> pairs into a gridRaw, validates dimensionality, cell counts, topology and isPeriodic length at parse time, then narrows into gridParams1D/2D/3D and calls makeGrid. Failures return a gridNull carrying the error stack. isPeriodic takes a pointer to a vector<bool> so its size can be checked against dim.
29 cases covering parse-time validation through runChecks and dimension dispatch through the gridBuilder macro, including isPeriodic size mismatches and out-of-order attributes.
Four examples covering 1D construction, 2D with periodicity, argument order independence, and parse-time error reporting.
@Tony-Drummond Tony-Drummond added Enhancement New feature or request Tests C++ Issues related to the MOLE C++ API Unit Testing Something fails in the auto-testing phases MOLE-2.0 Ideas and issues relating to the MOLE 2.0 development branch and or update. labels Aug 18, 2026
@Tony-Drummond
Tony-Drummond requested a review from jbrzensk August 18, 2026 18:57
dependabot Bot and others added 13 commits August 18, 2026 13:30
Bumps [pillow](https://github.com/python-pillow/Pillow) from 12.1.1 to 12.3.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](python-pillow/Pillow@12.1.1...12.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-version: 12.3.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Fix version specification for Pillow in requirements.txt

Signed-off-by: Christopher Paolini <paolini@engineering.sdsu.edu>
Bumps [pillow](https://github.com/python-pillow/Pillow) from 12.1.1 to 12.3.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](python-pillow/Pillow@12.1.1...12.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-version: 12.3.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Fix version specification for Pillow in requirements.txt

Signed-off-by: Christopher Paolini <paolini@engineering.sdsu.edu>
Fix version specification for Pillow in requirements.txt

Signed-off-by: Christopher Paolini <paolini@engineering.sdsu.edu>
Added the example/sys files
Adds gridBase::applyDebugMode and a debug_mode overload of each
grid1D/2D/3D constructor. The mode is applied once at construction
and is not stored.

The trigger is isValidatedGrid() rather than hasGridErrors(): a grid
carries MOLE_ERR_GRID_UNCHECKED until validation clears it, and
mergeErrors folds upstream errors into the same stack, so a valid
grid can hold errors it did not cause. Aborting on those would end
user programs over grids that are fine.

Reporting is non-destructive in every mode, so a caller can still
print or write the log afterwards.

Makes gridBase's constructor protected and gridNull's private,
reachable only through makeGridNull. Both classes are internal.

15 new tests, all binaries green.
Parses a debug pair carrying a MOLE debug mode and applies it to
the resulting grid. Dispatch moves into buildGrid so that every
path, including both failure paths, funnels through one point.

The debug pair has to come first: parsing stops at an unrecognized
attribute name, so a trailing debug pair is never read on the calls
that need it. Documented in the header and asserted in the tests.
Codes 14-17 mapped to empty strings; code 16 is logged by
gridBuilder on an unknown attribute, so users saw a bare code with
no message. Renumbers the dictionary comments (011-017, not
001-007) and corrects the gridBuilder range to 10-99.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C++ Issues related to the MOLE C++ API Enhancement New feature or request MOLE-2.0 Ideas and issues relating to the MOLE 2.0 development branch and or update. Tests Unit Testing Something fails in the auto-testing phases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants