Differences between revisions 1 and 2
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
 ___: mrisComputeOptimalRetessellation and mrisComputeRandomRetessellation have a similar structure mrisComputeOptimalRetessellation and mrisComputeRandomRetessellation have a similar structure
Line 10: Line 10:
___: ___: a computeDefectContext is constructed here _: _: a computeDefectContext is constructed here
Line 12: Line 12:
___:___: then it loops over a set of patches, or iterates on one patch. For each patch it calls _:_: then it loops over a set of patches, or iterates on one patch. For each patch it calls
Line 14: Line 14:
___:___:___: mrisDefectPatchFitness, which calls _:_:_: mrisDefectPatchFitness, which calls
Line 16: Line 16:
___:___:___: ___: mrisComputeDefectLogLikelihood, which calls _:_:_: _: mrisComputeDefectLogLikelihood, which calls
Line 18: Line 18:
___:___:___: ___: ___: mrisComputeDefectMRILogUnlikelihood, which _:_:_: _: _: mrisComputeDefectMRILogUnlikelihood, which
Line 20: Line 20:
___:___:___: ___: ___:___: does an expensive computation all the face normals for ALL the faces _:_:_: _: _:_: does an expensive computation all the face normals for ALL the faces
Line 22: Line 22:
___:___:___: ___: ___:___: does two other expensive steps, which only use a few of the face normals _:_:_: _: _:_: does two other expensive steps, which only use a few of the face normals

A variety of techniques have been used.

Deferring calculations until needed

Each face had a normal vector and area stored in the nx,ny,nz,orig_area members of the FACE struct.

mris_fix_topology has a hot loop

mrisComputeOptimalRetessellation and mrisComputeRandomRetessellation have a similar structure

_: _: a computeDefectContext is constructed here

_:_: then it loops over a set of patches, or iterates on one patch. For each patch it calls

_:_:_: mrisDefectPatchFitness, which calls

_:_:_: _: mrisComputeDefectLogLikelihood, which calls

_:_:_: _: _: mrisComputeDefectMRILogUnlikelihood, which

_:_:_: _: _:_: does an expensive computation all the face normals for ALL the faces

_:_:_: _: _:_: does two other expensive steps, which only use a few of the face normals

MorphoOptimizationProject_BetterSerialCode_DeferCalculations (last edited 2021-09-22 09:46:34 by DevaniCordero)