From 37c259d719ef72479464597d3d84ae4951fb9bb0 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Sun, 19 Jul 2015 23:10:53 +0400
Subject: [PATCH] small fixes

---
 css/main.css                            | 2 +-
 js/cells/DMACell.js                     | 4 +++-
 js/cells/supercells/DMASuperCell.js     | 4 +++-
 js/lattice/Lattice.js                   | 5 ++++-
 js/main.js                              | 2 +-
 js/menus/ESetupMenuView.js              | 2 +-
 js/menus/templates/ESetupMenuView.html  | 3 +++
 js/menus/templates/EStaticMenuView.html | 4 +++-
 8 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/css/main.css b/css/main.css
index d79cb8f3..81c6b8ef 100644
--- a/css/main.css
+++ b/css/main.css
@@ -216,7 +216,7 @@ hr {
 }
 
 input.intInput, input.floatInput{
-    width:21%;
+    width:20%;
     display: inline;
     padding: 8px 8px;
 }
diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js
index a73f09d5..d0169cc0 100644
--- a/js/cells/DMACell.js
+++ b/js/cells/DMACell.js
@@ -316,7 +316,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', '
                 if (child.name == "object3D") return;
                 child.visible = visible && (child.name == mode);
             });
-            self.setWireframeVisibility(!self.isTransparent, mode);
+            self.setWireframeVisibility(!self.isTransparent && visible, mode);
 
             if (callback) {
                 callback();
@@ -422,7 +422,9 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', '
     //parse
     DMACell.prototype.addToDenseArray = function(cellsArray, min){
         var index = this.getAbsoluteIndex().sub(min);
+        if (cellsArray[index.x][index.y][index.z]) return true;
         cellsArray[index.x][index.y][index.z] = this;
+        return false;
     };
 
     DMACell.prototype.removeFromDenseArray = function(cellsArray, min){
diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js
index 1347f297..81881a8d 100644
--- a/js/cells/supercells/DMASuperCell.js
+++ b/js/cells/supercells/DMASuperCell.js
@@ -115,9 +115,11 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'],
 
      //parse
     DMASuperCell.prototype.addToDenseArray = function(cellsArray, min){
+        var overlap = false;
         this._loopCells(function(cell){
-            if (cell) cell.addToDenseArray(cellsArray, min);
+            if (cell) overlap |= cell.addToDenseArray(cellsArray, min);
         });
+        return overlap;
     };
 
 
diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js
index c8ecae1d..7b498a40 100644
--- a/js/lattice/Lattice.js
+++ b/js/lattice/Lattice.js
@@ -17,6 +17,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             partType: null,
 
             denseCellsMin: null,
+            overlapDetected: false,
 
             nodes: [],
 
@@ -158,9 +159,11 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
             }
 
             var min = this.get("cellsMin").sub(bounds.min);
+            var self = this;
             this._loopCells(this.sparseCells, function(cell){
                 if (!cell) return;
-                cell.addToDenseArray(cells, min);
+                var overlap = cell.addToDenseArray(cells, min);
+                if (overlap) self.set("overlapDetected", true);
             });
 
             this.cells = cells;
diff --git a/js/main.js b/js/main.js
index d5db5721..025df6a3 100644
--- a/js/main.js
+++ b/js/main.js
@@ -155,7 +155,7 @@ require.config({
 
         //electronic sim
         eSim: 'simulation/electronics/eSim',
-        latticeESim: 'lattice/latticeESim',
+        latticeESim: 'lattice/LatticeESim',
         eSimCell: 'simulation/electronics/cells/eSimCell',
         eSimSuperCell: 'simulation/electronics/cells/eSimSuperCell',
 
diff --git a/js/menus/ESetupMenuView.js b/js/menus/ESetupMenuView.js
index 361820c2..74f4ca89 100644
--- a/js/menus/ESetupMenuView.js
+++ b/js/menus/ESetupMenuView.js
@@ -32,7 +32,7 @@ define(['jquery', 'underscore', 'menuParent', 'plist', 'text!eSetupMenuTemplate'
         },
 
         _makeTemplateJSON: function(){
-            return _.extend(this.model.toJSON(), eSim.toJSON(), plist);
+            return _.extend(this.model.toJSON(), eSim.toJSON(), plist, {overlapDetected:lattice.get("overlapDetected")});
         },
 
         template: _.template(template)
diff --git a/js/menus/templates/ESetupMenuView.html b/js/menus/templates/ESetupMenuView.html
index 7bc4f413..741707ab 100644
--- a/js/menus/templates/ESetupMenuView.html
+++ b/js/menus/templates/ESetupMenuView.html
@@ -1,3 +1,6 @@
+<% if (overlapDetected) { %>
+    <div class="postWarning">Overlapping cells detected, check that hierarchical cells are not placed on top of one another.  Simulation results may be inaccurate.</div>
+<% } %>
 Simulation Type: &nbsp;&nbsp;
     <div class="btn-group">
         <button data-toggle="dropdown" class="btn dropdown-toggle" type="button"><%= allMaterialClasses[materialClass] %><span class="caret"></span></button>
diff --git a/js/menus/templates/EStaticMenuView.html b/js/menus/templates/EStaticMenuView.html
index 3eade527..3db74993 100644
--- a/js/menus/templates/EStaticMenuView.html
+++ b/js/menus/templates/EStaticMenuView.html
@@ -1 +1,3 @@
-static calculations
\ No newline at end of file
+static calculations:<br/>
+capacitance<br/>
+inductance<br/>
\ No newline at end of file
-- 
GitLab