-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GSAGH-560: Analysis task is missing when adding 1D geometries or Loads from other models #722
base: release/10.2.14
Are you sure you want to change the base?
Conversation
SandeepArup
commented
Nov 7, 2024
…s from other models
} | ||
} catch { | ||
//not modal analysis task | ||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you create a test, where we return zero? Why the try catch? Perhaps we do catch on the method above and leave this private one to throw the error?
public void ModalAnalysisTaskAreCopiedInDuplicateModel(int methodId) { | ||
var original = new GsaModel(); | ||
int numberOfMode = 5; | ||
// Task | ||
var massOption = new MassOption(ModalMassOption.LumpMassAtNode, 1); | ||
var additionalMassDerivedFromLoads = new AdditionalMassDerivedFromLoads( | ||
"L1", | ||
Direction.Z, | ||
1 | ||
); | ||
var ModalDamping = new ModalDamping(0.5); | ||
var modalDynamicTaskParameter = new ModalDynamicTaskParameter( | ||
ModeCalculationMethod(methodId, numberOfMode), | ||
massOption, | ||
additionalMassDerivedFromLoads, | ||
ModalDamping | ||
); | ||
|
||
int taskId = original.ApiModel.AddAnalysisTask( | ||
AnalysisTaskFactory.CreateModalDynamicAnalysisTask( | ||
"task1", | ||
modalDynamicTaskParameter | ||
) | ||
); | ||
for (int mode = 1; mode <= numberOfMode; mode++) { | ||
original.ApiModel.AddAnalysisCaseToTask(taskId, "test case", mode); | ||
} | ||
System.Collections.ObjectModel.ReadOnlyDictionary<int, AnalysisTask> taskIn = original.ApiModel.AnalysisTasks(); | ||
|
||
//assemble model and get task | ||
var analysis = new GsaAnalysis(); | ||
foreach (KeyValuePair<int, AnalysisTask> analysisTask in taskIn) { | ||
analysis.AnalysisTasks.Add(new GsaAnalysisTask(analysisTask.Key, analysisTask.Value, original.ApiModel)); | ||
} | ||
var assembly = new ModelAssembly(new GsaModel(), null, null, null, null, null, analysis, | ||
LengthUnit.Meter, Length.Zero, false, null); | ||
var assembled = new GsaModel() { | ||
ApiModel = assembly.GetModel() | ||
}; | ||
System.Collections.ObjectModel.ReadOnlyDictionary<int, AnalysisTask> taskOut = assembled.ApiModel.AnalysisTasks(); | ||
|
||
Assert.Equal(taskIn.Count, taskIn.Count); | ||
foreach (int key in taskIn.Keys) { | ||
Assert.Equal(taskIn[key].Name, taskOut[key].Name); | ||
foreach (int caseId in taskIn[key].Cases) { | ||
Assert.Equal(assembled.ApiModel.AnalysisCaseName(caseId), original.ApiModel.AnalysisCaseName(caseId)); | ||
Assert.Equal(assembled.ApiModel.AnalysisCaseDescription(caseId), original.ApiModel.AnalysisCaseDescription(caseId)); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is too big
Can you create one test per exist condition of your new method?
You need 3 tests where the numberOfDynamicMode
is larger that 0 but comes from the 3 different type of modelCalculationStrategy
that it should have the analysisCaseToTask
being added like that _model.AddAnalysisCaseToTask(task.Id, ca.Name, mode);
and another case where the numberOfDynamicMode is Zero and the analysisCastToTask has been added through _model.AddAnalysisCaseToTask(task.Id, ca.Name, ca.Definition);
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release/10.2.14 #722 +/- ##
=================================================
- Coverage 90.1% 90.1% -0.1%
=================================================
Files 520 520
Lines 39291 39324 +33
Branches 4902 4911 +9
=================================================
+ Hits 35436 35465 +29
- Misses 2582 2585 +3
- Partials 1273 1274 +1
|