Changeset 750cff for src/documentation/constructs/parsers.dox
- Timestamp:
- Oct 31, 2011, 5:13:52 PM (14 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, Candidate_v1.7.0, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 5982c5
- Parents:
- 19bc74
- File:
-
- 1 edited
-
src/documentation/constructs/parsers.dox (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/documentation/constructs/parsers.dox
r19bc74 r750cff 12 12 * Author: heber 13 13 */ 14 15 /** \page parsers Format Parsers 16 * 17 * Format Parsers load or save information about the World (i.e. all atoms, 18 * contained bonds, ...) in a specific file format. 19 * 20 * All parsers derive from FormatParser and all available instances of 21 * FormatParser's are stored in a FormatParserStorage such that they can be 22 * retrieved with simply knowing the associated token. 23 * 24 * We have this storage as the FormatParser may also contain extra information 25 * per atom (...AtomDataContainer or alikes) which should be copied when an 26 * atom is copied. Hence, as soon as a FormatParser is accessed once it sits 27 * in the Storage and accumulates all information. Therefore, every parser 28 * instance is unique per type throughout the run of the program. 29 * 30 * A specific parser can be obtained from the FormatParserStorage just by 31 * knowing the correct keyword such as this: 32 * \code 33 * ParserTypes type = FormatParserStorage::getInstance().getTypeFromName("xyz"); 34 * FormatParserInterface &parser = FormatParserStorage::getInstance().get(type); 35 * \endcode 36 * 37 * Associated to the FormatParser's is also the ChangeTracker (\ref observers) 38 * that observers the World and tells all parsers on program exit whether 39 * to save or not (i.e. whether any changes occurred). FormatParser_common 40 * makes sure that each FormatParser signUp()s to this ChangeTracker. 41 * 42 * Important is also the concept of a Parameter here. A Parameter is a value 43 * of a certain type with a given valid range or set of valid values. There 44 * ContinuousValue and DiscreteValue template classes that are subsequently 45 * joined with a name to give a ContinuousParameter and DiscreteParameter to 46 * be stored via a unifying ParameterInterface into a ParameterStorage. Such 47 * an instance each of the FormatParser's contains. Therein extra information 48 * such as a basis set, unit length, energy cutoff or other parser-specific 49 * parameters are stored. 50 * 51 * Various actions (WorldInputAction, WorldOuputAction, AtomSaveSelectedAtomsAction, 52 * MoleculeSaveSelectedAction) use the parser to load or store atoms or to 53 * control the behavior of storage (ParserSetOutputFormatAction, ...) 54 * 55 * \section parsers-add To add a new parser ... 56 * 57 * The following tasks are necessary: 58 * -# think of unique brief name for your parser, e.g. "xyz" and add to 59 * \b ParserTypes.def. This will inform FormatParserStorage of your new parser. 60 * (Again there is some preprocessor magic for instanting all ...) 61 * -# Implement a FormatParserTraits specialization with some common stuff to 62 * your parsers 63 * \code 64 * template<> 65 * struct FormatParserTrait<name> 66 * { 67 * //!> Name of the parser 68 * static const std::string name; 69 * //!> suffix of the files the parser understands to read and write 70 * static const std::string suffix; 71 * //!> ParserTypes enumeration for the parser 72 * static const enum ParserTypes type; 73 * }; 74 * \endcode 75 * where \a name is the name unique name of your parser, e.g. \a xyz. 76 * -# Create all these static variables with matching contents. 77 * -# Implement a FormatParser specialization 78 * \code 79 * template <> 80 * class FormatParser< name > : virtual public FormatParserInterface, public FormatParser_common 81 * { 82 * ... 83 * }; 84 * \endcode 85 * where \a name is again the name of your parser. FormatParser_common 86 * contains some functionality common to all Parsers where FormatParserInterface 87 * is the interface where load() and save() are defined. This allows for storage 88 * in FormatParserRegistry. 89 * -# implement FormatParserInterface::load() and FormatParserInterface::save(). 90 * -# implement FormatParser_common::AtomInserted() and 91 * FormatParser_common::AtomRemoved() 92 * 93 * 94 * \date 2011-10-31 95 */
Note:
See TracChangeset
for help on using the changeset viewer.
