Skip to content
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

Draft
wants to merge 3 commits into
base: release/10.2.14
Choose a base branch
from

Conversation

SandeepArup
Copy link
Collaborator

image

@SandeepArup SandeepArup changed the base branch from main to release/10.2.13 November 7, 2024 09:07
@SandeepArup SandeepArup requested a review from psarras November 14, 2024 09:37
}
} catch {
//not modal analysis task
return 0;
Copy link
Collaborator

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?

Comment on lines +139 to +188
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));
}
}
}
Copy link
Collaborator

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);

@psarras psarras changed the base branch from release/10.2.13 to release/10.2.14 November 19, 2024 17:42
Copy link

codecov bot commented Nov 19, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 90.1%. Comparing base (76bde13) to head (d4f93c0).
Report is 1 commits behind head on release/10.2.14.

Files with missing lines Patch % Lines
GsaGH/Helpers/Assembly/ModelAssembly.cs 86.6% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                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     
Files with missing lines Coverage Δ
GsaGH/Helpers/Assembly/ModelAssembly.cs 85.4% <86.6%> (+<0.1%) ⬆️

... and 1 file with indirect coverage changes

---- 🚨 Try these New Features:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants