diff --git a/js/API/LatticeAPI.js b/js/API/LatticeAPI.js index 50b37acb2ccb86b3aa220344febca8c8e59cf8ed..c3c1b8d2f575d164d72708a2d01cdfc1e9f11f2a 100644 --- a/js/API/LatticeAPI.js +++ b/js/API/LatticeAPI.js @@ -88,7 +88,7 @@ define(['lattice', 'plist'], function(lattice){ }, setSparseCells: function(cells){ - lattice.reloadCells(cells); + lattice.setSparseCells(cells); }, getCells: function(){ diff --git a/js/cam/Cam.js b/js/cam/Cam.js index ec5e6d15dd418c7e110cc4385e9bd16a3eabb382..e19396454e2ebd5411cf60f97079d6eca9119d2c 100644 --- a/js/cam/Cam.js +++ b/js/cam/Cam.js @@ -277,7 +277,7 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel appState.set("stockSimulationPlaying", false); //todo isStreaming = false; three.stopAnimationLoop(); - lattice.showCells("cells"); + lattice.showCells(); }, _stockSimulation: function(){ @@ -298,7 +298,7 @@ define(['underscore', 'three', 'backbone', 'appState', 'latticeCAM', 'threeModel simulateCurrentLine: function(callback){ var lineNum = this.get("simLineNumber"); three.startAnimationLoop(); - if (lineNum == 0) lattice.hideCells("cells"); + if (lineNum == 0) lattice.hideCells(); var allLines = this.get("dataOut").split("\n"); if(lineNum < allLines.length){ diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index f025137b933d2726582ffdae36b9d7cba097a78d..d42e337de820235672b1c6496a12d9f22a9936a1 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -217,10 +217,10 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' this.object3D.visible = false; }; - DMACell.prototype.show = function(mode){ + DMACell.prototype.show = function(mode, callback){ this.object3D.visible = true; this.setTransparent(false); - this.setMode(mode); + this.setMode(mode, callback); }; DMACell.prototype.getMaterialID = function(){ diff --git a/js/cells/GIKCell.js b/js/cells/GIKCell.js index b1b54507b1a3691e4d7653ab33e1c50bf7c3737e..ff023e9c080b064615e6ce93ea15b76ee1bf5f82 100644 --- a/js/cells/GIKCell.js +++ b/js/cells/GIKCell.js @@ -85,7 +85,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cubeCell'], var self = this; this.superCell._loopCells(function(cell){ if (cell == self) return; - if (cell) cell.setConductorGroupNum(num); + cell.setConductorGroupNum(num); }); CubeCell.prototype.propagateConductorGroupNum.call(this, num); }; @@ -95,7 +95,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cubeCell'], var self = this; this.superCell._loopCells(function(cell){ if (cell == self) return; - if (cell) cell.setStructuralGroupNum(num); + cell.setStructuralGroupNum(num); }); CubeCell.prototype.propagateStructuralGroupNum.call(this, num); }; diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index 31f575565f119f386251ac09ef86ad60316ede1d..34112072a89128eb1cefe897789cbb3dbf8f33da 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -79,7 +79,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell', 'mat return child.name == "object3D"; }).length;//todo this is weird self._loopCells(function(cell){ - if (cell) cell.setMode(mode, function(){ + cell.setMode(mode, function(){ if (--numChildren <= 0) { if (callback) { callback(); @@ -105,14 +105,14 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell', 'mat DMASuperCell.prototype.setTransparentByEval = function(evalFunction){ DMACell.prototype.setTransparentByEval.call(this, evalFunction);//todo don't pass down to cells if no change this._loopCells(function(cell){ - if (cell) cell.setTransparentByEval(evalFunction); + cell.setTransparentByEval(evalFunction); }) }; DMASuperCell.prototype.setTransparent = function(transparent){ this._setTransparent(transparent); this._loopCells(function(cell){ - if (cell) cell._setTransparent(transparent); + cell._setTransparent(transparent); }) }; @@ -125,10 +125,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell', 'mat if (forCAM && this._isBottomLayer()) return DMACell.prototype.addToDenseArray.call(this, cellsArray, min);//this gives back the bottom layer cell for assembly, not necessarily the lattice pitch var overlap = []; this._loopCells(function(cell){ - if (cell) { - var overlappingCells = cell.addToDenseArray(cellsArray, min, forCAM) - if (overlappingCells) overlap = overlap.concat(overlappingCells); - } + var overlappingCells = cell.addToDenseArray(cellsArray, min, forCAM) + if (overlappingCells) overlap = overlap.concat(overlappingCells); }); if (overlap.length>0) return overlap; return null; @@ -146,29 +144,16 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell', 'mat for (var x=0;x<cells.length;x++){ for (var y=0;y<cells[0].length;y++){ for (var z=0;z<cells[0][0].length;z++){ - callback(cells[x][y][z], x, y, z, this); + if (cells[x][y][z]) callback(cells[x][y][z], x, y, z, this); } } } }; - DMASuperCell.prototype._iterCells = function(callback){ - var cells = this.cells; - _.each(cells, function(cellLayer){ - _.each(cellLayer, function(cellColumn){ - _.each(cellColumn, function(cell){ - callback(cell, cellColumn, cellLayer); - }); - }); - }); - }; - DMASuperCell.prototype.destroy = function(){ - this._iterCells(function(cell){ - if (cell) { - cell.destroy(); - cell = null; - } + this._loopCells(function(cell){ + cell.destroy(); + cell = null; }); DMACell.prototype.destroy.call(this); this.cells = null; @@ -176,7 +161,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell', 'mat DMASuperCell.prototype.destroyParts = function(){ this._loopCells(function(cell){ - if (cell) cell.destroyParts(); + cell.destroyParts(); }); }; diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index a90679a88bc96321fc3523973a402b2d0a104f38..af00b43276e96daac2a090a35bb56df882d6819b 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -175,6 +175,67 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis } }, + reloadCells: function(){ + this.setSparseCells(this.sparseCells); + }, + + setSparseCells: function(cells){ + if (cells === undefined || cells == null) { + console.warn("no cells given to setSparseCells"); + return; + } + this._setSparseCells(cells, this._getSubclassForLatticeType()); + }, + + _getSubclassForLatticeType: function(){ + var cellType = this.get("cellType"); + var connectionType = this.get("connectionType"); + var subclass = plist.allLattices[cellType].connection[connectionType].subclass; + if (subclass === undefined){ + console.warn("unrecognized cell type " + cellType); + return null; + } + return subclass; + }, + + _setSparseCells: function(cells, subclass){ + + if ((this.get("connectionType") == "gik" || this.previous("connectionType") == "gik")) this.clearCells(); + + this._setDefaultCellMode();//cell mode + + var cellsMin = this.get("cellsMin"); + var cellsMax = this.get("cellsMax"); + var numCells = this.get("numCells"); + + this.clearCells(); + if (this._undo) this._undo();//undo subclass methods + if (globals.basePlane) globals.basePlane.destroy(); + if (globals.highlighter) globals.highlighter.destroy(); + + console.log(cells); + if (cellsMax && cellsMin) this._checkForMatrixExpansion(cells, cellsMax, cellsMin); + + var self = this; + require([subclass], function(subclassObject){ + _.extend(self, subclassObject); + self._initLatticeType();//init for lattice subclass + if (numCells > 0) { + self._bindRenderToNumCells(numCells); + self.parseCellsJSON(cells); + } + }); + }, + + _setDefaultCellMode: function(){//if no part associated with this lattice type set to cell mode + var latticeData = this._getLatticePlistData(); + if (latticeData.parts === undefined){ + var currentMode = appState.get("cellMode"); + if (currentMode == "cell" || currentMode == "supercell") return; + appState.set("cellMode", "cell"); + } + }, + @@ -216,26 +277,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis } }, - _setDefaultCellMode: function(){//if no part associated with this lattice type - var latticeData = this._getLatticePlistData(); - if (latticeData.parts === null){ - var currentMode = appState.get("cellMode"); - if (currentMode == "cell" || currentMode == "supercell") return; - appState.set("cellMode", "cell"); - } - }, - - _getSubclassForLatticeType: function(){ - var cellType = this.get("cellType"); - var connectionType = this.get("connectionType"); - var subclass = plist.allLattices[cellType].connection[connectionType].subclass; - if (subclass === undefined){ - console.warn("unrecognized cell type " + cellType); - return null; - } - return subclass; - }, - xScale: function(){ return this.get("aspectRatio").x; }, @@ -330,10 +371,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis return this.compositeEditor !== null && this.compositeEditor !== undefined; }, - _isSingltonLattice: function(){ - return true; - }, - exitCompositeEditing: function(){ if (this.compositeEditor) this.compositeEditor.destroy(); this.compositeEditor = null; @@ -347,7 +384,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis reinitAllCellsOfTypes: function(types){//when material definition is changed this._loopCells(this.sparseCells, function(cell, x, y, z, self){ - if (!cell) return; var material = cell.getMaterial(); if (material && material.isComposite() && types.indexOf(material.getID()) > -1){ //re-init cell; diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index e6d2630d8bd62dd7a44a9a56a7f5343fc31350d4..a94d420d628bf51e0a73e95443220256405e8718 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -59,38 +59,27 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre return plist.allLattices[this.get("cellType")].connection[this.get("connectionType")].type[this.get("applicationType")]; }, - reloadCells: function(cells, subclass){ + _setSparseCells: function(cells, subclass){ - if ((this.get("connectionType") == "gik" || this.previous("connectionType") == "gik") && !cells) this.clearCells(); + this.clearCells();//composite lattice should always be empty - if (!cells) cells = JSON.parse(JSON.stringify(this.sparseCells)); - - if (this._setDefaultCellMode) this._setDefaultCellMode();//only on lattice + console.log(this.get("numCells")); + var numCells = this.get("numCells"); - var cellsMin = this.get("cellsMin"); var cellsMax = this.get("cellsMax"); - this._bindRenderToNumCells(this.get("numCells")); - this.clearCells(); - - if (this._undo) this._undo(); - if (this._isSingltonLattice()){ - if (globals.basePlane) globals.basePlane.destroy(); - if (globals.highlighter) globals.highlighter.destroy(); - } + var cellsMin = this.get("cellsMin"); + if (cellsMax && cellsMin) this._checkForMatrixExpansion(cells, cellsMax, cellsMin); - if (cellsMax && cellsMin) this._checkForMatrixExpansion(this.sparseCells, cellsMax, cellsMin); var self = this; - require([subclass || this._getSubclassForLatticeType()], function(subclassObject){ + require([subclass], function(subclassObject){ _.extend(self, subclassObject); - if (self._isSingltonLattice()) self._initLatticeType();//only do this for the lattice singleton - if (self.get("cellsMin")) self.parseCellsJSON(cells); + if (numCells>0) { + self._bindRenderToNumCells(numCells); + self.parseCellsJSON(cells); + } }); }, - _isSingltonLattice: function(){ - return false; - }, - _bindRenderToNumCells: function(numCells){ var self = this; if (numCells > 0) this.listenTo(this, "change:numCells", function(){ @@ -206,7 +195,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre clearCells: function(silent){ if (silent === undefined) silent = false; this._loopCells(this.sparseCells, function(cell){//send destroy to top level - if (cell) cell.destroy(); + cell.destroy(); }); this.cells = [[[null]]]; this.sparseCells = [[[null]]]; @@ -222,16 +211,14 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre var dimMax = this.get("cellsMax").clone().sub(this.get("cellsMin")).add(new THREE.Vector3(1,1,1)); var dimMin = new THREE.Vector3(0,0,0); this._loopCells(this.sparseCells, function(cell, x, y, z){ - if (cell){ - var material = cell.getMaterial(); - var dimensions = material.dimensions; - if (dimensions) dimensions = dimensions.clone(); - else dimensions = new THREE.Vector3(cell.length, 1, 1); - dimensions.sub(new THREE.Vector3(1,1,1)); - var subCellRange = (new THREE.Vector3(x, y, z)).add(cell.applyRotation(dimensions).round().add(new THREE.Vector3(1,1,1))); - dimMax.max(subCellRange); - dimMin.min(subCellRange); - } + var material = cell.getMaterial(); + var dimensions = material.dimensions; + if (dimensions) dimensions = dimensions.clone(); + else dimensions = new THREE.Vector3(cell.length, 1, 1); + dimensions.sub(new THREE.Vector3(1,1,1)); + var subCellRange = (new THREE.Vector3(x, y, z)).add(cell.applyRotation(dimensions).round().add(new THREE.Vector3(1,1,1))); + dimMax.max(subCellRange); + dimMin.min(subCellRange); }); return {max:dimMax, min:dimMin}; }, @@ -379,16 +366,14 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre var yTrim = true; var zTrim = true; this._loopCells(cells, function(cell, x, y, z){ - if (cell){ - if (fromFront){ - if (x == 0) xTrim = false; - if (y == 0) yTrim = false; - if (z == 0) zTrim = false; - } else { - if (x == cellsMax.x-cellsMin.x) xTrim = false; - if (y == cellsMax.y-cellsMin.y) yTrim = false; - if (z == cellsMax.z-cellsMin.z) zTrim = false; - } + if (fromFront){ + if (x == 0) xTrim = false; + if (y == 0) yTrim = false; + if (z == 0) zTrim = false; + } else { + if (x == cellsMax.x-cellsMin.x) xTrim = false; + if (y == cellsMax.y-cellsMin.y) yTrim = false; + if (z == cellsMax.z-cellsMin.z) zTrim = false; } }); @@ -443,55 +428,57 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre //events _updatePartType: function(){ - this._iterCells(this.sparseCells, function(cell){ - if (cell) cell.destroyParts(); + this._loopCells(this.sparseCells, function(cell){ + cell.destroyParts(); }); this._updateForMode(); }, _updateForMode: function(){ var cellMode = appState.get("cellMode"); - var numCells = this.get("numCells"); if (cellMode == "hide"){ - this._iterCells(this.sparseCells, function(cell){ - if (cell) cell.hide(); - }); - three.render(); + this.hideCells(); return; } + if (appState.previous("cellMode") == "hide"){ - this._iterCells(this.sparseCells, function(cell){ - if (cell) cell.show(); - }); + this.showCells(); + } else { + this._setAllCellsMode(cellMode); } + }, - this._iterCells(this.sparseCells, function(cell){ - if (cell) cell.setMode(cellMode, function(){ - if (--numCells <= 0) three.render(); - }); + _setAllCellsMode: function(cellMode){ + var numCells = this.get("numCells"); + var renderCallback = function(){ + if (--numCells <= 0) three.render(); + }; + this._loopCells(this.sparseCells, function(cell){ + cell.setMode(cellMode, renderCallback); }); }, - hideCells: function(whichArray){ - if (!whichArray) whichArray = "sparseCells"; - this._iterCells(this[whichArray], function(cell){ - if (cell) cell.hide(); + hideCells: function(){ + this._loopCells(this.sparseCells, function(cell){ + cell.hide(); }); three.render(); }, - showCells: function(whichArray){ - if (!whichArray) whichArray = "sparseCells"; + showCells: function(){ var cellMode = appState.get("cellMode"); - this._iterCells(this[whichArray], function(cell){ - if (cell) cell.show(cellMode) + var numCells = this.get("numCells"); + var renderCallback = function(){ + if (--numCells <= 0) three.render(); + }; + this._loopCells(this.sparseCells, function(cell){ + cell.show(cellMode, renderCallback); }); - three.render(); }, setOpaque: function(){ this._loopCells(this.sparseCells, function(cell){ - if (cell) cell.setTransparent(false); + cell.setTransparent(false); }); three.render(); }, @@ -503,17 +490,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre //utils - _iterCells: function(cells, callback){ - _.each(cells, function(cellLayer){ - _.each(cellLayer, function(cellColumn){ - _.each(cellColumn, function(cell){ - callback(cell, cellColumn, cellLayer); - }); - }); - - }); - }, - loopCells: function(callback){ this._loopCells(this.sparseCells, callback); }, @@ -522,7 +498,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre for (var x=0;x<cells.length;x++){ for (var y=0;y<cells[0].length;y++){ for (var z=0;z<cells[0][0].length;z++){ - callback(cells[x][y][z], x, y, z, this); + if (cells[x][y][z]) callback(cells[x][y][z], x, y, z, this); } } } @@ -567,7 +543,6 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre var overlap = []; var forCAM = appState.get("currentNav") == "navAssemble"; this._loopCells(this.sparseCells, function(cell){ - if (!cell) return; var overlappingCells = cell.addToDenseArray(cells, min, forCAM); if (overlappingCells) overlap = overlap.concat(overlappingCells); }); @@ -578,7 +553,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre highlightOverlappingCells: function(){ this._loopCells(this.sparseCells, function(cell){ - if (cell) cell.setTransparent(true); + cell.setTransparent(true); }); _.each(this.get("overlappingCells"), function(cell){ cell.show(); @@ -602,10 +577,8 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre parseCellsJSON: function(sparseCells){ var cellsMin = this.get("cellsMin"); this._loopCells(sparseCells, function(cell, x, y, z, self){ - if (cell) { - var json = _.extend({index: (new THREE.Vector3(x, y, z)).add(cellsMin)}, cell); - self._addCellWithJSON(json, new THREE.Vector3(x, y, z)); - } + var json = _.extend({index: (new THREE.Vector3(x, y, z)).add(cellsMin)}, cell); + self._addCellWithJSON(json, new THREE.Vector3(x, y, z)); }); }, diff --git a/js/models/FileSaver.js b/js/models/FileSaver.js index 8fe09e1199878654ac6a4a0163268f43b542b221..95188c55324685ab7d49d95b5c8bb2278f6b9538 100644 --- a/js/models/FileSaver.js +++ b/js/models/FileSaver.js @@ -103,7 +103,7 @@ define(['underscore', 'fileSaverLib', 'lattice', 'materials', 'ribbon', 'menuWra lattice.clearCells(); var sparseCells = data.assembly.sparseCells; _setData(lattice, _.omit(data.assembly, "sparseCells")); - if (sparseCells) lattice.reloadCells(sparseCells); + if (sparseCells) lattice.setSparseCells(sparseCells); ribbon.render(); menuWrapper.render(); } diff --git a/js/models/SerialComm.js b/js/models/SerialComm.js index 3ecfc76f948fb9f29121a187db383ca612ab15a3..a13737f9ee0433295c33943210f48ac0a18f6bc9 100644 --- a/js/models/SerialComm.js +++ b/js/models/SerialComm.js @@ -30,7 +30,7 @@ define(['underscore', 'backbone', 'socketio', 'machineState', 'cam', 'lattice', }, _navChanged: function(){ - if (appState.previous("currentNav") == "navComm") lattice.showCells("cells"); + if (appState.previous("currentNav") == "navComm") lattice.showCells(); }, attemptToConnectToNode: function(){ @@ -82,7 +82,7 @@ define(['underscore', 'backbone', 'socketio', 'machineState', 'cam', 'lattice', if (machineState && machineState.isReadyStatus()){ var lineNum = cam.get("simLineNumber"); var allLines = cam.get("dataOut").split("\n"); - if (lineNum == 0) lattice.hideCells("cells"); + if (lineNum == 0) lattice.hideCells(); if (lineNum >= 0 && lineNum < allLines.length) { var line = allLines[lineNum]; diff --git a/js/simulation/electronics/LatticeEsim.js b/js/simulation/electronics/LatticeEsim.js index 12ba608586a25d594ec1c53c2e100c0448013e90..da2f88b330e64314706d638766a0f30e474a511a 100644 --- a/js/simulation/electronics/LatticeEsim.js +++ b/js/simulation/electronics/LatticeEsim.js @@ -24,7 +24,7 @@ define(['lattice', 'appState', 'three', 'threeModel', 'numeric', 'eSim', 'eSimFi } var allVisible = groupNum == -1; this._loopCells(this.sparseCells, function(cell){ - if (cell) cell.setTransparentByEval(function(evalCell){ + cell.setTransparentByEval(function(evalCell){ return !(evalCell.conductiveGroupVisible(allVisible, groupNum)); }); }); @@ -40,7 +40,7 @@ define(['lattice', 'appState', 'three', 'threeModel', 'numeric', 'eSim', 'eSimFi } var allVisible = groupNum == -1; this._loopCells(this.sparseCells, function(cell){ - if (cell) cell.setTransparentByEval(function(evalCell){ + cell.setTransparentByEval(function(evalCell){ return !(allVisible || evalCell.structuralGroupVisible(groupNum)); }); }); @@ -50,10 +50,10 @@ define(['lattice', 'appState', 'three', 'threeModel', 'numeric', 'eSim', 'eSimFi calculateStructuralConnectivity: function(){ var num = 1; this._loopCells(this.cells, function(cell){ - if (cell) cell.setStructuralGroupNum(num++, true); + cell.setStructuralGroupNum(num++, true); }); this._loopCells(this.cells, function(cell){ - if (cell) cell.propagateStructuralGroupNum(); + cell.propagateStructuralGroupNum(); }); this._calcNumberStructurallyConnectedComponents(); this._showConductors(); @@ -62,7 +62,6 @@ define(['lattice', 'appState', 'three', 'threeModel', 'numeric', 'eSim', 'eSimFi _calcNumberStructurallyConnectedComponents: function(){ var groups = {}; this._loopCells(this.cells, function(cell){ - if (!cell) return; if (_.filter(groups, function(group){ return group.id == cell.getStructuralGroupNum(); }).length == 0) { @@ -75,10 +74,10 @@ define(['lattice', 'appState', 'three', 'threeModel', 'numeric', 'eSim', 'eSimFi calculateConductorConnectivity: function(){ var num = 1; this._loopCells(this.cells, function(cell){ - if (cell) cell.setConductorGroupNum(num++, true); + cell.setConductorGroupNum(num++, true); }); this._loopCells(this.cells, function(cell){ - if (cell) cell.propagateConductorGroupNum(); + cell.propagateConductorGroupNum(); }); this._calcNumberDCConnectedComponents(); this._showConductors(); @@ -87,7 +86,6 @@ define(['lattice', 'appState', 'three', 'threeModel', 'numeric', 'eSim', 'eSimFi _calcNumberDCConnectedComponents: function(){ var groups = {}; this._loopCells(this.cells, function(cell){ - if (!cell) return; if (_.filter(groups, function(group){ return group.id == cell.getConductorGroupNum(); }).length == 0 && cell.isConductive()) { @@ -132,7 +130,6 @@ define(['lattice', 'appState', 'three', 'threeModel', 'numeric', 'eSim', 'eSimFi //input conductor potentials this._loopCells(this.cells, function(cell, x, y, z){ - if (!cell) return; for (var i=0;i<resolution;i++){ for (var j=0;j<resolution;j++){ for (var k=0;k<resolution;k++){