-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python extension #25
Open
markcmiller86
wants to merge
41
commits into
markcmiller86:main
Choose a base branch
from
remontel:python-extension
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Python extension #25
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…edundant libfoo.so
…ce code for shared library), test_pyheat.py (test script), and updated makefile to build shared libary
- Separated HeatProblem, HeatSolution, and HeatRun structures for clarity - Refactored global arrays to hold instances of problem, solution, and run data - Updated init_problem and init_solution functions to initialize respective structures - Modified solve_heat_equation to correctly parse arguments and match expected types - Updated heat.py to test the new implementation with correct argument types
- Separated HeatProblem, HeatSolution, and HeatRun structures for clarity - Refactored global arrays to hold instances of problem, solution, and run data - Updated init_problem and init_solution functions to initialize respective structures - Modified solve_heat_equation to correctly parse arguments and match expected types - Updated test_heat.py to test the new implementation with correct argument types Merge branch 'main' into python-extension
1. Static Arrays and Index Management: • Static arrays problems, solutions, and runs are used to hold the data for each type of object. • Indices problemIndex, solutionIndex, and runIndex track the next available slot in each array. 2. Initialization Functions: • init_problem: Initializes a HeatProblem structure and returns its index. • init_solution: Initializes a HeatSolution structure and returns its index. 3. Simulation Function: • run_simulation: Runs the heat simulation using the initialized problem and solution, and stores run-specific settings. - Removed dynamic memory allocation (malloc) from pyheat.c - Included update_solution_ftcs function declaration - Added detailed comments to explain the code
1. Static Arrays and Index Management: • Static arrays problems, solutions, and runs are used to hold the data for each type of object. • Indices problemIndex, solutionIndex, and runIndex track the next available slot in each array. 2. Initialization Functions: • init_problem: Initializes a HeatProblem structure and returns its index. • init_solution: Initializes a HeatSolution structure and returns its index. 3. Simulation Function: • run_simulation: Runs the heat simulation using the initialized problem and solution, and stores run-specific settings. - Removed dynamic memory allocation (malloc) from pyheat.c - Included update_solution_ftcs function declaration - Added detailed comments to explain the code
1. Added Problem Index to HeatSolution: - Updated structure to include to reference the associated problem. 2. Corrected init_solution Function: - Modified function to set the when initializing a solution. 3. Corrected run_simulation Function: - Updated function to retrieve the structure using from . - Ensured proper memory access and stability during simulation runs. 4. Added return_simulation_results Function: - Implemented function to return simulation results. - Added a placeholder implementation that returns a sample result for testing purposes. These changes correct the segmentation fault by properly referencing the associated problem for each solution and add the missing function to resolve the AttributeError.
1. Added Problem Index to HeatSolution: - Updated HeatSolution structure to include probIndex to reference the associated problem. 2. Corrected init_solution Function: - Modified init_solution function to set the probIndex when initializing a solution. 3. Corrected run_simulation Function: - Updated run_simulation function to retrieve the HeatProblem structure using probIndex from HeatSolution. - Ensured proper memory access and stability during simulation runs. 4. Added return_simulation_results Function: - Implemented return_simulation_results function to return simulation results. - Added a placeholder implementation that returns a sample result for testing purposes. 5. Updated heat.py to reflect changes made to pyheat.c
…ts to pyheat.c to improve initialization, simulation, and result retrieval functions. The code has been refactored to store simulation results in arrays, replicating the functionality of the curve files in the original heat application. This allows the user to interact with the results data (e.g., graph in gnuplot). Changes have also been made to ensure better error handling, memory management, and code consistency. **Detailed Changes** 1. **Initialization Functions**: - **init_problem**: - Added a check to ensure the number of problems does not exceed MAX_PROBLEMS. - Refactored to allow for storing of results in array - Improved error handling and documentation. - **init_solution**: - Added a check to ensure the number of solutions does not exceed MAX_SOLUTIONS. - Refactored to allow for storing of results in array - Improved error handling and documentation. 2. **Simulation Function**: - **run_simulation**: - Added error handling to check for valid solution and run indices. - Included memory allocation for times and t_results. - Utilized the copy function from utils.c to store results periodically. - Ensured the function checks for solution stability and raises an error if the solution becomes unstable. - Ensured the solIndex is correctly set in the HeatRun structure. 3. **Result Retrieval Function**: - **return_simulation_results**: - Added condition to check if runIndex is within valid limits by comparing it against MAX_RUNS - Ensured the function correctly references the HeatSolution associated with the given HeatRun. - Created nested lists to store and return simulation results, with each inner list representing the temperature results for a specific time step.
…' now makes all object files
…ulation_results does not correctly return results
…tion to be used in pyheat.c
1. now uses strdup to allocate memory for 2. now uses from utils.c to set initial conditions 3. now checks if the time index is empty and iterates before continuing. 4. Added notes to print error message letting user know to use correct arguments when passing data 5. Minor editing to improve readability of code
…ple and plot with matplotlib
…blem function. Called with help(pyheat.problem).
…hm when running solution function. Updated heat.py test script to reflect changes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Create initial PR for merging @remontel python extension module work to main