Browse Source

add GetNearFieldSettings.vue

Konstantin Ladutenko 3 years ago
parent
commit
33e8c9c502

+ 72 - 13
guiapp/src/components/GetNearFieldSettings.vue

@@ -1,22 +1,64 @@
 <template>
   <div class="row items-baseline">
-    <div class="col-xs-12 col-sm-auto text-weight-bold text-center q-px-md q-py-sm">
+    <div class="col-xs-12 col-sm-auto text-weight-bold text-center q-pr-md q-py-sm">
       <div :style="flexRowTitleStyle">
-        Host media
+        Plot
       </div>
     </div>
     <div class="col-xs-grow col-sm">
-      <div class="row justify-xs-center justify-sm-start items-center">
 
-        <div class="col-auto" ><input-with-units
-            v-model:input-result="hostIndex"
+      <div class="row justify-center items-baseline">
+        <div class="col-auto text-center q-py-xs q-pr-md">
+          <div :style="flexRowTitleStyle" >
+        relative size
+          </div>
+        </div>
+        <div class="col-xs-grow col-sm">
+          <div class="row justify-xs-center justify-sm-start items-center">
+            <input-with-units
+            v-model:input-result="relativePlotSize"
             v-model:is-showing-help="isShowingHelpForInputWithUnits"
-            :initial-expression="hostIndex.toString()"
-            title="Re(n)"
+            :initial-expression="relativePlotSize.toString()"
+            title="x / 2R"
             units=""
-        /></div>
-
+            /></div>
+        </div>
+      </div>
+      <div class="row justify-center items-baseline">
+        <div class="col-auto text-center q-py-xs q-pr-md">
+          <div :style="flexRowTitleStyle" >
+            resolution
+          </div>
+        </div>
+        <div class="col-xs-grow col-sm">
+          <div class="row justify-xs-center justify-sm-start items-center">
+            <input-with-units
+                v-model:input-result="plotSideResolution"
+                v-model:is-showing-help="isShowingHelpForInputWithUnits"
+                :initial-expression="plotSideResolution.toString()"
+                title="points"
+                units=""
+            /></div>
+        </div>
+      </div>
+      <div class="q-ma-xs"/>
+      <div class="row justify-center items-center">
+        <div class="col-auto text-center q-py-xs q-pr-md">
+          <div :style="flexRowTitleStyle" >
+            cross-section
+          </div>
+        </div>
+        <div class="col-xs-grow col-sm">
+          <div class="row justify-xs-center justify-sm-start items-center">
+            <div class="q-gutter-md q-py-sm q-px-xs">
+              <q-radio v-model="crossSection" dense size='sm' :val="nearFieldType.both" :label="nearFieldType.both" />
+              <q-radio v-model="crossSection" dense size='sm' :val="nearFieldType.Ek" :label="nearFieldType.Ek" />
+              <q-radio v-model="crossSection" dense size='sm' :val="nearFieldType.Hk" :label="nearFieldType.Hk" />
+            </div>
+          </div>
+        </div>
       </div>
+
     </div>
   </div>
 </template>
@@ -29,6 +71,7 @@ import {
 import { useStore } from 'src/store'
 import InputWithUnits from 'components/InputWithUnits.vue'
 import { flexRowTitleStyle } from 'components/config'
+import { nearFieldType } from 'src/store/simulation-setup/state';
 
 export default defineComponent({
 
@@ -43,12 +86,28 @@ export default defineComponent({
       set: val => $store.commit('guiRuntime/setIsShowingHelpForInputWithUnits', val)
     })
 
-    const hostIndex = computed({
-      get: () => $store.state.simulationSetup.gui.hostIndex,
-      set: val => $store.commit('simulationSetup/setHostIndex', val)
+    const crossSection = computed({
+      get: () => $store.state.simulationSetup.gui.nearFieldSetup.crossSection,
+      set: val => $store.commit('simulationSetup/setNearFieldCrossSection', val)
+    })
+
+    const relativePlotSize = computed({
+      get: () => $store.state.simulationSetup.gui.nearFieldSetup.relativePlotSize,
+      set: val => $store.commit('simulationSetup/setNearFieldRelativePlotSize', val)
+    })
+
+    const maxComputeTime = computed({
+      get: () => $store.state.simulationSetup.gui.nearFieldSetup.maxComputeTime,
+      set: val => $store.commit('simulationSetup/setNearFieldMaxComputeTime', val)
+    })
+
+    const plotSideResolution = computed({
+      get: () => $store.state.simulationSetup.gui.nearFieldSetup.plotSideResolution,
+      set: val => $store.commit('simulationSetup/setNearFieldPlotSideResolution', val)
     })
 
-    return { hostIndex, isShowingHelpForInputWithUnits, flexRowTitleStyle}
+    return { crossSection, isShowingHelpForInputWithUnits, flexRowTitleStyle,
+    relativePlotSize, maxComputeTime, plotSideResolution, nearFieldType}
   },
 })
 </script>

+ 3 - 3
guiapp/src/components/GetWlFromPlot.vue

@@ -2,7 +2,7 @@
   <div>
     <div class="row items-baseline">
 
-      <div class="col-xs-12 col-sm-auto text-weight-bold text-center q-px-md q-py-sm">
+      <div class="col-xs-12 col-sm-auto text-weight-bold text-center q-pr-md q-py-sm">
         <div :style="flexRowTitleStyle"> Source plane wave </div>
       </div>
       <div class="col-xs-grow col-sm">
@@ -15,7 +15,7 @@
               :units="sourceUnits"
               title="at"
           /></div>
-          <div class="col-auto"> or <span class="text-bold">click on plot</span> below to select data point</div>
+          <div class="col-auto q-px-sm"> or <span class="text-bold">click on plot</span> below to select a data point</div>
 
         </div>
       </div>
@@ -91,7 +91,7 @@ export default defineComponent({
 
 
     const currentWavelengthInSourceUnits = computed({
-      get: () => toUnits($store.state.simulationSetup.gui.nearFieldWL, sourceUnits.value),
+      get: () => toUnits($store.state.simulationSetup.gui.nearFieldSetup.atWL, sourceUnits.value),
       set: val => $store.commit('simulationSetup/setNearFieldWL', fromUnits(sourceUnits.value, val))
     })
 

+ 1 - 0
guiapp/src/pages/Far-field.vue

@@ -12,6 +12,7 @@
       Input result: {{$store.state.simulationSetup.gui.fromWL}}
     </div>
     <!-- place QPageScroller at end of page -->
+    <div class="q-ma-lg"/>
     <q-page-scroller position="bottom-right" :scroll-offset="150" :offset="[18, 18]">
       <q-btn size="xs" fab icon="keyboard_arrow_up" color="primary" />
     </q-page-scroller>

+ 1 - 0
guiapp/src/pages/Info.vue

@@ -43,6 +43,7 @@
       </q-card-section>
     </q-card>
     <!-- place QPageScroller at end of page -->
+    <div class="q-ma-xl"/>
     <q-page-scroller position="bottom-right" :scroll-offset="150" :offset="[18, 18]">
       <q-btn size="xs" fab icon="keyboard_arrow_up" color="primary" />
     </q-page-scroller>

+ 1 - 0
guiapp/src/pages/Materials.vue

@@ -9,6 +9,7 @@
     <PlotMaterials/>
     <div class="q-ma-xs"/>
     <!-- place QPageScroller at end of page -->
+    <div class="q-ma-lg"/>
     <q-page-scroller position="bottom-right" :scroll-offset="150" :offset="[18, 18]">
       <q-btn size="xs" fab icon="keyboard_arrow_up" color="primary" />
     </q-page-scroller>

+ 3 - 1
guiapp/src/pages/Near-field.vue

@@ -6,8 +6,10 @@
     <div class="q-ma-xs"/>
     <GetNearFieldSettings/>
     <div class="col-auto">
-      Input result: {{$store.state.simulationSetup.gui.nearFieldWL}}
+      Input result: {{$store.state.simulationSetup.gui.nearFieldSetup.crossSection}}
     </div>
+
+    <div class="q-ma-lg"/>
     <!-- place QPageScroller at end of page -->
     <q-page-scroller position="bottom-right" :scroll-offset="150" :offset="[18, 18]">
       <q-btn size="xs" fab icon="keyboard_arrow_up" color="primary" />

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

@@ -23,6 +23,7 @@
     <PlotSpectra/>
 
     <!-- place QPageScroller at end of page -->
+    <div class="q-ma-lg"/>
     <q-page-scroller position="bottom-right" :scroll-offset="150" :offset="[18, 18]">
       <q-btn size="xs" fab icon="keyboard_arrow_up" color="primary" />
     </q-page-scroller>

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

@@ -1,5 +1,5 @@
 import { MutationTree } from 'vuex';
-import { simulationSetupStateInterface as sssi, simulationSetup, layer } from './state';
+import { simulationSetupStateInterface as sssi, simulationSetup, layer, nearFieldType } from './state';
 import { cloneDeep } from 'lodash'
 import { markRaw} from 'vue'
 
@@ -39,10 +39,16 @@ const mutation: MutationTree<sssi> = {
   setFromWL    (state: sssi, val: number) {state.gui.fromWL    = val},
   setToWL      (state: sssi, val: number) {state.gui.toWL      = val},
   setPointsWL  (state: sssi, val: number) {state.gui.pointsWL  = val},
-  setNearFieldWL   (state: sssi, val: number) { state.gui.nearFieldWL = val},
-  setFarFieldWL    (state: sssi, val: number) { state.gui.farFieldWL  = val},
-  setNumberOfModesToPlot  (state: sssi, val: number) {state.gui.numberOfModesToPlot  = val},
   setPlotLabel (state: sssi, val: string) {state.gui.plotLabel = val},
+  setNumberOfModesToPlot  (state: sssi, val: number) {state.gui.numberOfModesToPlot  = val},
+
+  setNearFieldWL                 (state: sssi, val: number)        {state.gui.nearFieldSetup.atWL               = val},
+  setNearFieldRelativePlotSize   (state: sssi, val: number)        {state.gui.nearFieldSetup.relativePlotSize   = val},
+  setNearFieldPlotSideResolution (state: sssi, val: number)        {state.gui.nearFieldSetup.plotSideResolution = val},
+  setNearFieldCrossSection       (state: sssi, val: nearFieldType) {state.gui.nearFieldSetup.crossSection       = val},
+  setNearFieldMaxComputeTime     (state: sssi, val: number)        {state.gui.nearFieldSetup.maxComputeTime     = val},
+
+  setFarFieldWL    (state: sssi, val: number) { state.gui.farFieldWL  = val},
 
 };
 

+ 34 - 5
guiapp/src/store/simulation-setup/state.ts

@@ -19,13 +19,29 @@ export interface layer {
   k: number
 }
 
+export enum nearFieldType {
+  Ek = 'Ek',
+  Hk = 'Hk',
+  both = 'both'
+}
+
+export interface nearFieldSetup {
+  atWL:number
+  relativePlotSize: number
+  plotSideResolution: number
+  crossSection: nearFieldType
+  maxComputeTime: number //in seconds
+}
+
 export interface simulationSetup {
   hostIndex: number
   fromWL: number; toWL:number; pointsWL:number
-  nearFieldWL:number; farFieldWL:number
   layers: layer[]
   numberOfModesToPlot: number
   plotLabel: string
+
+  nearFieldSetup: nearFieldSetup,
+  farFieldWL:number
 }
 
 export interface simulationSetupStateInterface {
@@ -40,7 +56,6 @@ export interface simulationSetupStateInterface {
 
 function setupFactory(hostIndex = 1,
                       fromWL = 400, toWL=1000, pointsWL=201,
-                      nearFieldWL = 619, farFieldWL = 619,
                       layers = [
                         {layerWidth:100, n:4, k:0.01,
                           material: {name:'nk-constant',
@@ -49,14 +64,28 @@ function setupFactory(hostIndex = 1,
                         },
                       ],
                       numberOfModesToPlot = 4,
-                      plotLabel = ''
-                     ):simulationSetup {
+                      plotLabel = '',
+
+                      nearFieldSetup = {
+                        atWL: 619,
+                        relativePlotSize: 2,
+                        plotSideResolution: 64,
+                        crossSection: nearFieldType.both,
+                        maxComputeTime: 5 //in seconds
+                      },
+
+                      farFieldWL = 619,
+
+):simulationSetup {
   return {hostIndex:hostIndex,
     fromWL:fromWL, toWL:toWL, pointsWL:pointsWL,
-    nearFieldWL:nearFieldWL, farFieldWL:farFieldWL,
     layers: cloneDeep(layers),
     numberOfModesToPlot: numberOfModesToPlot,
     plotLabel: plotLabel,
+
+    nearFieldSetup:nearFieldSetup,
+
+    farFieldWL:farFieldWL,
   }
 }