Changes between Version 3 and Version 4 of AstroBearObjects
- Timestamp:
- 05/05/11 14:28:54 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AstroBearObjects
v3 v4 33 33 == Using Objects == 34 34 35 All AstroBEAR objects share a common creation and destruction interface. To create a new object of type {{{AstroObj}}}, call the {{{CreateAstroObj()}}} subroutine in {{{ProblemInitializeModule()}}}. This creates a new object whose properties you can then modify. Many objects require further initialization to affect the problem domain, either before or during the run. These objects usually come with {{{GridInit()}}} and {{{beforeStep()}}} routines. 35 36 36 Using these objects within a problem module is as simple as calling the createobject subroutine during the ProblemInitializeModule routine - and then modifying the objects properties. For instance !MyClump%radius, !MyClump%density, or !MyWind%dir, !MyWind%edge, !MyPointGravity%mass, etc... All of the difficult coding and loops that deal with properly updating the grids is already taken care of. Of course you might find that an object does not have all of the features you need. In that case you can manually modify grids as in AstroBear in the routines ProblemGridInit, ProblemBeforeStep, ProblemAfterStep, and ProblemSetErrFlags. You could also add the needed feature to an existing object - or consider creating a new object. Adding features to existing objects is fairly straightforward - and will not break other people's problem modules as long as the new default values effectively turn the new feature off.37 To make memory management less hellish, our objects also come with destruction routines. '''BE SURE TO USE THESE ROUTINES IF YOU PLAN ON DELETING AN OBJECT.''' This is the best way to make sure that ''all'' of the memory these objects use is safely freed. 37 38 38 = Information on Existing objects = 39 Most of the AstroBEAR standard objects have the bulk of their inner workings encapsulated by simple subroutines. Review the documentation for each object carefully so that you understand how to use these routines; they are there to make object use simple and intuitive. 40 41 [[BR]] 42 == Developing New Objects == 43 44 45 === Modifying Existing Objects === 46 47 Adding features to existing objects is fairly straightforward--simply add the required attributes to the object's definition and include whatever additional methods operate on that object. It is important to remember, though, that other people rely on these objects to behave as advertised. To be on the safe side, make sure that your new feature is turned off by default. That way, you aren't leaving nasty surprises for other people who use the object. 48 49 Modifications are a little trickier, especially if you are substantially changing the behavior of the object. Developers are advised to consult with the AstroBEAR team before modifying the behavior of existing objects, so that the changes can be thoroughly vetted and announced to the community at large. 50 51 52 53 == Information on Existing objects == 39 54 * [UniformRegions Uniform Regions] 40 55 * [SplitRegions Split Regions] … … 44 59 * [OutflowObjects Outflow Sources] 45 60 46 = Information on !SubObjects=61 === Information on !SubObjects === 47 62 * [ShapeObjects Shapes] 48 63 * [InterfaceObjects Interfaces]