|
|
[Home](Home)
|
|
[Home](Home)
|
|
|
# How to Add Features
|
|
# How to Add Features
|
|
|
|
|
|
|
|
## Adding Solvers
|
|
This page details how to add your own features to the code. Everything has been designed with scalability in mind, so it is easy to add new things to the code, but it's important to keep the formatting of everything as consistent as possible so that the code remains clean and easy to understand. **Remember that when adding a new feature that you should always be working in a new git branch**, only merging once your new feature is finished and free of bugs.
|
|
|
|
|
|
|
|
## Adding Problem
|
|
|
|
|
|
|
|
Adding a new problem to the code is probably the most difficult/time-consuming feature to add, mostly because it requires you to understand both how to use FEniCS in general, as well as how our specific code handles solving. Before attempting this, it is recommended that you refresh yourself on the AbstractProblem class (documentation for it can be found in [Base Classes](Base Classes). Always remember that you can look to existing [Problems](Problems) for guidance on general formatting.
|
|
|
|
|
|
|
|
[TODO: finish writing this section]
|
|
|
|
|
|
|
|
## Adding Observers
|
|
## Adding Observers
|
|
|
|
|
|
|
|
|
Adding a new observer is one of the easier features to add, to do so follow these steps:
|
|
|
|
|
|
|
|
1. Go to the Observers.py file in the src directory and edit it
|
|
|
|
|
|
|
|
2. Create a new class for your observer, give it a unique and descriptive name
|
|
|
|
|
|
|
|
3. Add an `__init__(self, problem, params)` method, and initialize whatever variables you want the observer to have access to
|
|
|
|
when it gets updated, if your observer does not need anything initialized, you may omit this method
|
|
|
|
|
|
|
|
4. Add an `update(self, problem)` method, and insert what you want the observer to do when it is updated
|
|
|
|
|
|
|
|
5. Add a `finish(self, problem)` method, and insert what the observer should do when the solving is done, if you don't want it
|
|
|
|
to do anything, just add `pass`
|
|
|
|
|
|
|
|
6. Once you are sure the observer works correctly, commit your changes and merge the branch you are working on back into dev
|
|
|
|
and push your changes to the remote repository
|
|
|
|
|
|
|
|
7. Add your new observer to the [Observers](Observers) page on the wiki and follow the formatting of the other observers on
|
|
|
|
that page (give a description of what it does and document what parameters are needed for it)
|
|
|
|
|
|
|
## Adding Mesh Presets
|
|
## Adding Mesh Presets
|
|
|
|
|
|
|
|
## Adding Custom Expressions |
|
## Adding Custom Expressions |
|
|
|
\ No newline at end of file |