Просмотр исходного кода

moved test of nmiejs module into state initialization

Konstantin Ladutenko 3 лет назад
Родитель
Сommit
45acd07a99

+ 22 - 34
guiapp/src/App.vue

@@ -24,40 +24,28 @@ import { defineComponent } from 'vue';
 // const nmie = new nmiejs.nmie();
 
 
-import nmiejs from './nmiejs.js';
-// Test nmiejs if working
-void (async () => {
-  const module = await nmiejs();
-  const nmie = new module.nmie();
-  nmie.ClearTarget();
-  let R = 100.0;
-  let reN = 4.0;
-  let imN = 0.01;
-  nmie.AddTargetLayerReIm(R, reN, imN)
-  nmie.SetModeNmaxAndType(-1, -1);
-  let WL = 800;
-  nmie.SetWavelength(WL);
-  nmie.RunMieCalculation();
-  console.log(nmie.GetQsca());
-  // outer_arc_points, radius_points, from_Rho, to_Rho,
-  // from_Theta, to_Theta, from_Phi, to_Phi, isIgnoreAvailableNmax
-  nmie.RunFieldCalculationPolar(2, 2, 0.1, 1.5, 0, 3.1415, 0, 3.1415, 0);
-  console.log('Field Eabs:', nmie.GetFieldEabs());
-
-
-})();
-
-
-// nmie.ClearTarget();
-// let R = 100.0;
-// let reN = 4.0;
-// let imN = 0.01;
-// nmie.AddTargetLayerReIm(R, reN, imN)
-// nmie.SetModeNmaxAndType(-1, -1);
-// let WL = 800;
-// nmie.SetWavelength(WL);
-// nmie.RunMieCalculation();
-// console.log(nmie.GetQsca());
+// import nmiejs from './nmiejs.js';
+// // Test nmiejs if working
+// void (async () => {
+//   const module = await nmiejs();
+//   const nmie = new module.nmie();
+//   nmie.ClearTarget();
+//   let R = 100.0;
+//   let reN = 4.0;
+//   let imN = 0.01;
+//   nmie.AddTargetLayerReIm(R, reN, imN)
+//   nmie.SetModeNmaxAndType(-1, -1);
+//   let WL = 800;
+//   nmie.SetWavelength(WL);
+//   nmie.RunMieCalculation();
+//   console.log(nmie.GetQsca());
+//   // outer_arc_points, radius_points, from_Rho, to_Rho,
+//   // from_Theta, to_Theta, from_Phi, to_Phi, isIgnoreAvailableNmax
+//   nmie.RunFieldCalculationPolar(2, 2, 0.1, 1.5, 0, 3.1415, 0, 3.1415, 0);
+//   console.log('Field Eabs:', nmie.GetFieldEabs());
+//
+//
+// })();
 
 // const extractModule = async (module) => {
 //   const { instance } = await module();

+ 0 - 3
guiapp/src/components/GetNumberOfModes.vue

@@ -29,10 +29,7 @@
 <script lang="ts">
 import {
   defineComponent,
-  ref,
-  reactive,
   computed,
-  watch
   } from 'vue'
 import { useStore } from 'src/store'
 import { flexRowTitleStyle } from 'components/utils'

+ 5 - 1
guiapp/src/pages/Spectrum.vue

@@ -10,6 +10,8 @@
     <GetParticleParameters/>
     <div class="q-ma-xs"/>
     <GetNumberOfModes/>
+    <div class="q-ma-xs"/>
+    <RunSimulationSpectrum/>
     <div class="col-auto q-pa-md">
       Input result: {{$store.state.simulationSetup.gui.numberOfModesToPlot}}
     </div>
@@ -25,12 +27,14 @@ import GetHostIndex from 'components/GetHostIndex.vue'
 import GetSourceParameters from 'components/GetSourceParameters.vue'
 import GetParticleParameters from 'components/GetParticleParameters.vue'
 import GetNumberOfModes from 'components/GetNumberOfModes.vue'
+import RunSimulationSpectrum from 'components/RunSimulationSpectrum.vue'
 // import { useStore } from 'src/store'
 
 
 export default defineComponent({
   name: 'PageIndex',
-  components: {GetUnits, GetHostIndex, GetSourceParameters,
+  components: {
+    RunSimulationSpectrum, GetUnits, GetHostIndex, GetSourceParameters,
     GetParticleParameters, GetNumberOfModes},
   setup() {
     // const $store = useStore()

+ 4 - 0
guiapp/src/store/simulation-setup/mutations.ts

@@ -7,6 +7,10 @@ const mutation: MutationTree<sssi> = {
                newVal: simulationSetup) {
     state.gui = cloneDeep(newVal)
   },
+  setCurrentState (state: sssi,
+               newVal: simulationSetup) {
+    state.current = cloneDeep(newVal)
+  },
   setLayers    (state: sssi,
                 newVal: layer[]) {
     state.gui.layers = cloneDeep(newVal)

+ 23 - 0
guiapp/src/store/simulation-setup/state.ts

@@ -1,5 +1,6 @@
 import { cloneDeep } from 'lodash'
 import Spline from 'cubic-spline-ts'
+import nmiejs from 'src/nmiejs.js';
 
 export interface layer {
   layerWidth: number
@@ -41,6 +42,28 @@ function setupFactory(hostIndex = 1,
 }
 
 function state(): simulationSetupStateInterface {
+  // Test nmiejs if working
+  void (async () => {
+    const module = await nmiejs();
+    const nmie = new module.nmie();
+    nmie.ClearTarget();
+    const R = 100.0;
+    const reN = 4.0;
+    const imN = 0.01;
+    nmie.AddTargetLayerReIm(R, reN, imN)
+    nmie.SetModeNmaxAndType(-1, -1);
+    const WL = 800;
+    nmie.SetWavelength(WL);
+    nmie.RunMieCalculation();
+    console.log(nmie.GetQsca());
+    // outer_arc_points, radius_points, from_Rho, to_Rho,
+    // from_Theta, to_Theta, from_Phi, to_Phi, isIgnoreAvailableNmax
+    nmie.RunFieldCalculationPolar(2, 2,
+        0.1, 1.5, 0, 3.1415, 0, 3.1415,
+        0);
+    console.log('Field Eabs:', nmie.GetFieldEabs());
+  })();
+
   const gui = setupFactory()
   const current = cloneDeep(gui)
   const library = new Map<string,simulationSetup>()