mor.reduction.reduceModel.ReduceModel
- class ReduceModel(originalScene, nodeToReduce, listObjToAnimate, tolModes, tolGIE, outputDir, packageName='myReducedModel', addToLib=False, verbose=False, addRigidBodyModes=False, nbrCPU=4, phaseToSave=None, saveVelocitySnapshots=None, listPathToAnimation=[])[source]
Bases:
objectMain class that will perform the reduction
argument
type
definition
originalScene
str
absolute path to original scene
nodeToReduce
str
Paths to models to reduce
listObjToAnimate
list(
ObjToAnimate)list conaining all the ObjToAnimate that will be use to shake our model
tolModes
float
tolerance applied to choose the modes
tolGIE
float
tolerance applied to calculated GIE
outputDir
str
absolute path to output directiry in which all results will be stored
packageName
str
Which name will have the final componant ( & package if the option addToLib is activated)
addToLib
Bool
If
Truewill add in the python library of this plugin the finalized reduced componentverbose
Bool
display more or less verbose
addRigidBodyModes
list(int)
List of 3 of 0/1 that will allow translation along [x,y,z] axis of our reduced model
nbrCPU
int
Number of CPU we will use to generate/calculate the reduced model
phaseToSave
list(int)
List of 0/1 indicating during which phase to save the elements/X0
by default will save during first phaseMethods
generateTestScenePerform all the steps of the reduction in one function
The step will launch in parallel multiple Sofa scene (nbrCPU by nbrCPU number of scene) until it has run all the scene in the sequence.
With the previous result obtain in during :meth:`phase1` we compute the modes
This step will launch in parallel multiple Sofa scene (nbrCPU by nbrCPU number of scene) until it has run all the scene in the sequence.
The final step will gather all the results in 1 folder and build a reusable scene from it
Will generate a list containing dictionnaries, where each dictionnary is a set of argument for the execution of one SOFA scene.
- setListSofaScene(phasesToExecute=None, phase=None)[source]
Will generate a list containing dictionnaries, where each dictionnary is a set of argument for the execution of one SOFA scene.
argument
type
definition
phasesToExecute
list(int)
Allow to choose which phase to execute for the reduction
by default will select all the phaseThe number of dictionnaries generated depend upon either the number of action possibility (self.reductionAnimations.nbPossibility) or you can give with phasesToExecute specifically which possibility you want to execute.
example :
You have 2
ObjToAnimate(thing that will be animated during the execution). From self.reductionAnimations you will have 2^2 possibilities:[0,0] | [0,1] | [1,0] | [1,1] –> where 0 mean no animation & 1 animation
- if you give no argument, phasesToExecute = [0,1,2,3]
it will execute possibilty 0,1,2 & 3
- if you give phasesToExecute=[1,3]
it will execute possibility 1 & 3
- performReduction(phasesToExecute=None, nbrOfModes=None)[source]
Perform all the steps of the reduction in one function
argument
type
definition
phasesToExecute
list(int)
Allow to choose which phase to execute for the reductionmore details seesetListSofaScenenbrOfModes
int
Number of modes you want to keepby default will keep them allIf you are sure of all the parameters this way is recommended to gain time
- phase1(phasesToExecute=None)[source]
The step will launch in parallel multiple Sofa scene (nbrCPU by nbrCPU number of scene) until it has run all the scene in the sequence.
argument
type
definition
phasesToExecute
list(int)
Allow to choose which phase to execute for the reductionmore details seesetListSofaSceneTo run the SOFA scene in parallele we use the
sofa launcherutilityWhat does it do to each scene:
Add animation to each
ObjToAnimatewe want for our model in the predifined sequenceAdd a componant to save the shaking resulting states (WriteState)
Take all the resulting states files and combines them in one file put in the
debugdir with a debug scene
- phase2()[source]
With the previous result obtain in during :meth:`phase1` we compute the modes
See
ReadStateFilesAndComputeModesfor the way the modes are determined.It will set
nbrOfModesto its maximum, but it can be changed has argument to the next step :phase3
- phase3(phasesToExecute=None, nbrOfModes=None)[source]
This step will launch in parallel multiple Sofa scene (nbrCPU by nbrCPU number of scene) until it has run all the scene in the sequence.
argument
type
definition
phasesToExecute
list(int)
Allow to choose which phase to execute for the reductionmore details seesetListSofaScenenbrOfModes
int
Number of modes you want to keepby default will keep them allTo run the SOFA scene in parallele we use the
sofa launcherutilityWhat does it do to each scene:
- Take the previous one and add the model order reduction component:
HyperReducedFEMForceField
MappedMatrixForceFieldAndMas
ModelOrderReductionMapping
Produce an Hyper Reduced description of the model
Produce files listing the different element to keep
Take all the resulting states files and combines them in one file put in the
debugdir with a debug scene
- phase4(nbrOfModes=None)[source]
The final step will gather all the results in 1 folder and build a reusable scene from it
argument
type
definition
nbrOfModes
int
Number of modes you want to keepby default will keep them allFinal step :
compute the RID and Weigts with
ReadGieFileAndComputeRIDandWeightsfinalize the package
add it to the plugin library if option activated