-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from Morpho-lang/wrapup
Wrapup
- Loading branch information
Showing
5 changed files
with
62 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
test/functionals/volumeenclosed/volencl_zeroelement.morpho
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import meshtools | ||
import optimize | ||
|
||
var vertexlist = [[0.5,0.5,0.5], [0.5,1.5,0.5], [1.5,1.5,0.5], [1.5,0.5,0.5], [0.5,0.5,1.5],[0.5,1.5,1.5], [1.5,1.5,1.5], [1.5,0.5,1.5]] | ||
|
||
var facelist = [[0,3,2,1], [0,4,5,1], [0,3,7,4], [2,3,7,6], [4,5,6,7], [1,2,6,5]] | ||
|
||
var m = PolyhedronMesh(vertexlist, facelist) | ||
|
||
for (id in 0...m.count()) { | ||
var x = m.vertexposition(id) | ||
x -= Matrix([1,1,1])/2 | ||
m.setvertexposition(id, x) | ||
} | ||
|
||
var problem = OptimizationProblem(m) | ||
|
||
var la = Area() | ||
var lv = VolumeEnclosed() | ||
|
||
problem.addenergy(la) | ||
problem.addconstraint(lv) | ||
|
||
var opt = ShapeOptimizer(problem, m) | ||
|
||
opt.relax(1) // expect error 'VolEnclZero' |