Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Add more SubDyn fields to parse and set defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
deslaughter committed May 13, 2024
1 parent 4a71828 commit 2541ed6
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fio.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,11 @@ type ElastoDyn struct {

type HydroDyn struct {
FileBase
WaveMod Integer `json:"WaveMod"`
ExctnMod Integer `json:"ExctnMod"`
PotFile Path `json:"PotFile" ftype:"Misc"`
WaveMod Integer `json:"WaveMod"`
WvDiffQTF Bool `json:"WvDiffQTF"`
WvSumQTF Bool `json:"WvSumQTF"`
ExctnMod Integer `json:"ExctnMod"`
PotFile Path `json:"PotFile" ftype:"Misc"`
}

func (h *HydroDyn) PostParse() error {
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/Model.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ function setDefaults() {
files.AeroDyn[0].SkewMod.Value = 0
}
// Set HydroDyn file linearization defaults
if (files.HydroDyn.length > 0) {
files.HydroDyn[0].WaveMod.Value = 0
files.HydroDyn[0].WvDiffQTF.Value = false
files.HydroDyn[0].WvSumQTF.Value = false
files.HydroDyn[0].ExctnMod.Value = 0
}
// Save changes to model
project.updateModel()
}
Expand Down
49 changes: 49 additions & 0 deletions frontend/wailsjs/go/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,10 @@ export namespace main {
Name: string;
Type: string;
Lines: string[];
WaveMod: Integer;
WvDiffQTF: Bool;
WvSumQTF: Bool;
ExctnMod: Integer;
PotFile: Path;

static createFrom(source: any = {}) {
Expand All @@ -993,6 +997,10 @@ export namespace main {
this.Name = source["Name"];
this.Type = source["Type"];
this.Lines = source["Lines"];
this.WaveMod = this.convertValues(source["WaveMod"], Integer);
this.WvDiffQTF = this.convertValues(source["WvDiffQTF"], Bool);
this.WvSumQTF = this.convertValues(source["WvSumQTF"], Bool);
this.ExctnMod = this.convertValues(source["ExctnMod"], Integer);
this.PotFile = this.convertValues(source["PotFile"], Path);
}

Expand All @@ -1014,6 +1022,44 @@ export namespace main {
return a;
}
}
export class SubDyn {
Name: string;
Type: string;
Lines: string[];
CBMod: Bool;
Nmodes: Integer;

static createFrom(source: any = {}) {
return new SubDyn(source);
}

constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.Name = source["Name"];
this.Type = source["Type"];
this.Lines = source["Lines"];
this.CBMod = this.convertValues(source["CBMod"], Bool);
this.Nmodes = this.convertValues(source["Nmodes"], Integer);
}

convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class Reals {
Name: string;
Type: string;
Expand Down Expand Up @@ -1176,6 +1222,7 @@ export namespace main {
Main: Main[];
ElastoDyn: ElastoDyn[];
BeamDyn: BeamDyn[];
SubDyn: SubDyn[];
AeroDyn: AeroDyn[];
AeroDyn14: AeroDyn14[];
HydroDyn: HydroDyn[];
Expand All @@ -1195,6 +1242,7 @@ export namespace main {
this.Main = this.convertValues(source["Main"], Main);
this.ElastoDyn = this.convertValues(source["ElastoDyn"], ElastoDyn);
this.BeamDyn = this.convertValues(source["BeamDyn"], BeamDyn);
this.SubDyn = this.convertValues(source["SubDyn"], SubDyn);
this.AeroDyn = this.convertValues(source["AeroDyn"], AeroDyn);
this.AeroDyn14 = this.convertValues(source["AeroDyn14"], AeroDyn14);
this.HydroDyn = this.convertValues(source["HydroDyn"], HydroDyn);
Expand Down Expand Up @@ -1417,6 +1465,7 @@ export namespace main {





}

Expand Down

0 comments on commit 2541ed6

Please sign in to comment.