Ticket #1884 (closed: fixed)

Opened 10 years ago

Last modified 5 years ago

Geometry: Simplify the class hierarchy of ParametrizedComponent and other ParX classes.

Reported by: Janik Zikovsky Owned by: Janik Zikovsky
Priority: major Milestone: Iteration 26
Component: Mantid Keywords:
Cc: pf9@… Blocked By:
Blocking: Tester: Michael Whitty

Description

This is a fairly large refactoring of the Geometry project, with the purpose of simplifying the class hierarchy significantly by folding in Parameterized versions of all the Components into a single class.

The design is currently this:

  • a Component object holds the position etc. of an instrument's (base) component.
  • For a parametrized instrument, a ParametrizedComponent is created which wraps the original Component with the addition of a const reference to a ParameterMap (m_map), as well as a pointer to the base (un-parametrized) Component (m_base).
    • Every function in Component needs to have the same implemented in ParameterizedComponent.
      • Most functions in ParameterizedComponent simply call m_base->function(...)
      • Only a few require actually different behavior (e.g. getting position).
  • The ParametrizedComponent is created by a factory.

This would not be so bad if there were only Component that needed parametrized version. However, EVERY class in the instrument needs its equivalent Par... version.

This THEN means that there needs to be an IComponent interface to interface between ParametrizedComponent and Component. So for each 1 REAL class, there are 2 MORE classes; triple the complexity!

This is then multiplied by all the classes that have their corresponding ParXXX and IXXX versions:

  • Component
  • Instrument
  • ObjComponent
  • CompAssembly
  • ObjCompAssembly
  • RectangularDetector

My proposed design:

  • The Component object will be made to act as either a parametrized Component or a base component.
  • The new Component can have a pointer to a ParameterMap object (m_map) containing its parameters, as well as a pointer to its base Component (m_base)
    • If it DOES, that means it is a parametrized Component.
    • Functions called on Component will check if it is parametrized, and act accordingly - either call the unparametrized m_base object, or perform the adjustments required by the ParameterMap.
  • The ParComponentFactory still acts the same way - except it returns a new instance of Component with the ParameterMap and base set, instead of a different class.

Advantages:

  • Two-to-Three-fold reduction in the required number of classes. Some of the interfaces will be kept at least at first; especially IComponent as it is used throughout the code.
    • Maintenance of the code will be that much easier (modify one function instead of 2-3).
    • I believe this will make the design much easier to understand for new developers.

Development:

  • A separate branch will be created for this development, and kept merged with the running trunk to try to keep things up to date.

Change History

comment:1 Changed 10 years ago by Janik Zikovsky

  • Status changed from new to accepted

comment:2 Changed 10 years ago by Janik Zikovsky

To clarify my last point: development will be kept in the branch until complete, showing that it builds and tests well fully, before merging back to trunk when it is stable.

comment:3 Changed 10 years ago by Janik Zikovsky

(In [7286]) Refs #1884: Creation of a branch for simplifying the Geometry class hierarchy.

comment:4 Changed 10 years ago by Janik Zikovsky

(In [7320]) Refs #1884: Initial checking in. Geometry builds. ParametrizedComponent replaced by Component and ParameterMap's now held with pointers.

comment:5 Changed 10 years ago by Janik Zikovsky

(In [7322]) Refs #1884: Geometry/test/ComponentTest.h runs successfully.

comment:6 Changed 10 years ago by Janik Zikovsky

(In [7323]) Refs #1884: ParametrizedComponentTest passes using the Component class.

comment:7 Changed 10 years ago by Janik Zikovsky

(In [7324]) Refs #1884: Four more tests pass.

comment:8 Changed 10 years ago by Janik Zikovsky

(In [7326]) Refs #1884: ParObjComponent test passes with very little modification.

comment:9 Changed 10 years ago by Janik Zikovsky

(In [7327]) Refs #1884: Forgot to delete ParObjComponent.h

comment:10 Changed 10 years ago by Janik Zikovsky

(In [7328]) Refs #1884: ParDetector deleted and ParDetectorTest passes.

comment:11 Changed 10 years ago by Janik Zikovsky

(In [7329]) Refs #1884: Small test added.

comment:12 Changed 10 years ago by Janik Zikovsky

(In [7331]) Refs #1884: ParCompAssembly removed; ParCompAssemblyTest passes using CompAssembly.

comment:13 Changed 10 years ago by Janik Zikovsky

(In [7332]) Refs #1884: A few functions weren't tested.

comment:14 Changed 10 years ago by Janik Zikovsky

(In [7333]) Refs #1884: Made sure ObjComponent functions were also handling both parmetrized/not- versions.

comment:15 Changed 10 years ago by Janik Zikovsky

(In [7334]) Refs #1884: Minor things in Component.

comment:16 Changed 10 years ago by Janik Zikovsky

(In [7335]) Refs #1884: ParObjCompAssembly deleted; both tests *ObjCompAssemblyTest.h pass.

comment:17 Changed 10 years ago by Janik Zikovsky

(In [7337]) Refs #1884: ParInstrument deleted. Both *Instrument tests pass.

comment:18 Changed 10 years ago by Janik Zikovsky

(In [7338]) Refs #1884: InstrumentRayTracerTest passes.

comment:19 Changed 10 years ago by Janik Zikovsky

(In [7339]) Refs #1884: All tests in the Geometry project pass!

comment:20 Changed 10 years ago by Janik Zikovsky

(In [7340]) Refs #1884: Kernel, Geometry, API all build.

comment:21 Changed 10 years ago by Janik Zikovsky

(In [7342]) Refs #1884: All API tests pass.

comment:22 Changed 10 years ago by Janik Zikovsky

(In [7344]) Refs #1884: LoadInstrument test runs.

comment:23 Changed 10 years ago by Janik Zikovsky

(In [7345]) Refs #1884: Almost all DataHandling tests pass, except SaveCanSAS1d

comment:24 Changed 10 years ago by Janik Zikovsky

(In [7346]) Refs #1884: Almost all Algorithms tests pass; remaining failures are due to disk access problems maybe? The same tests tests for me in the trunk.

comment:25 Changed 10 years ago by Janik Zikovsky

I meant, "The same tests fail for me in the trunk. " Also CurveFitting all tests from the same revision.

comment:26 Changed 10 years ago by Janik Zikovsky

(In [7347]) Refs #1884: PythonAPI builds; am getting pyconfig.h not found when running tests, so I think something is up with my config.

comment:27 Changed 10 years ago by Janik Zikovsky

(In [7348]) Refs #1884: Fixed my test failure.

comment:28 Changed 10 years ago by Janik Zikovsky

(In [7349]) Refs #1884: Merged trunk changes up to rev 7348 in the branch qtiplot

comment:29 Changed 10 years ago by Janik Zikovsky

(In [7351]) Refs #1884: Same fix as in the trunk to SANSRunWindow

comment:30 Changed 10 years ago by Janik Zikovsky

(In [7364]) Refs #1884: qtiplot builds.

comment:31 Changed 10 years ago by Janik Zikovsky

(In [7365]) Refs #1884: Committing modified eclipse project files.

comment:32 Changed 10 years ago by Janik Zikovsky

(In [7366]) Refs #1884: Merged trunk/Kernel into my branch.

comment:33 Changed 10 years ago by Janik Zikovsky

(In [7367]) Refs #1884: Merged ICAT from trunk to branch

comment:34 Changed 10 years ago by Janik Zikovsky

(In [7368]) Refs #1884: Merged trunk/Geometry into branch.

comment:35 Changed 10 years ago by Janik Zikovsky

(In [7370]) Refs #1884: Merged API and DataObjects from trunk to branch

comment:36 Changed 10 years ago by Janik Zikovsky

(In [7371]) Refs #1884: Merged trunk/Algorithms and CurveFitting into branch.

comment:37 Changed 10 years ago by Janik Zikovsky

(In [7372]) Refs #1884: Merged MDAlgorithms and Nexus

comment:38 Changed 10 years ago by Janik Zikovsky

(In [7373]) Refs #1884: Merged PythonAPI and UserAlgorithms

comment:39 Changed 10 years ago by Janik Zikovsky

(In [7376]) Refs #1884: More namespace issues with MantidQt files. compiles for me now.

comment:40 Changed 10 years ago by Janik Zikovsky

(In [7378]) Refs #1884: Committing before merging.

comment:41 Changed 10 years ago by Janik Zikovsky

(In [7380]) Refs #1884: Merging branch into trunk. Several classes in Geometry were removed in order to simplify parametrized components. ParDetector, ParObjComponent, etc. are now handled in the same class.

comment:42 Changed 10 years ago by Janik Zikovsky

(In [7381]) Refs #1884: Changes to MantidQt to compile

comment:43 Changed 10 years ago by Janik Zikovsky

(In [7382]) Refs #1884: Changes to qtiplot to compile

comment:44 Changed 10 years ago by Janik Zikovsky

(In [7384]) Refs #1884: Disabled SaveCanSAS1dTest while I try to fix it.

comment:45 Changed 10 years ago by Janik Zikovsky

(In [7396]) Refs #1884: SaveCanSAS check in. Not complete yet, but we don't have git

comment:46 Changed 10 years ago by Janik Zikovsky

(In [7404]) Refs #1884: Speed-ups to the modified geometry system.

comment:47 Changed 10 years ago by Janik Zikovsky

(In [7414]) Refs #1884: Re-enabled SaveCanSas1D test, it passes on my machine. Added test for Component::getAncestors().

comment:48 Changed 10 years ago by Janik Zikovsky

  • Status changed from accepted to verify
  • Resolution set to fixed

comment:49 Changed 10 years ago by Janik Zikovsky

(In [7550]) Refs #1884: Deleting simplified geometry branch that has been merged in the trunk.

comment:50 Changed 10 years ago by Michael Whitty

  • Status changed from verify to verifying
  • Tester set to Michael Whitty

comment:51 Changed 10 years ago by Michael Whitty

  • Status changed from verifying to closed

things are indeed much simpler in Geometry now. everything seems to have been working for the last five weeks of development so I'm going to go with the assumption that anything this might have broke would have been found by now.

comment:52 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 2731

Note: See TracTickets for help on using tickets.