Skip to content

Commit

Permalink
2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomusy committed Apr 15, 2020
1 parent 471ae90 commit 4a6c7e6
Show file tree
Hide file tree
Showing 42 changed files with 1,941 additions and 1,987 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@
"# 'data' still contains the last iteration points\n",
"vp += Points(data, r=2, c=\"yellow\")\n",
"\n",
"# the first fitted slope direction is stored\n",
"# in mesh.info['slope] and mesh.info['normal]\n",
"print(\"Line Fit slope = \", vp.actors[0].info[\"slope\"])\n",
"\n",
"plane = fitPlane(data) # fit a plane\n",
"print(\"Plan Fit normal=\", plane.info[\"normal\"])\n",
"\n",
"vp += plane\n",
"vp += fitPlane(data) # fit a plane\n",
"\n",
"vp.show()"
]
Expand Down
43 changes: 5 additions & 38 deletions notebooks/basic/pca.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,9 @@
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1m\u001b[32minside points # 249\u001b[0m\n",
"\u001b[1m\u001b[31moutside points # 251\u001b[0m\n",
"\u001b[1ma-sphericity: 0.010310868419372739\u001b[0m\n",
"\u001b[1mError in triangulate()\u001b[0m\n",
"\u001b[1mError in triangulate()\u001b[0m\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a3837ca4488f4c97900adfae6f30cade",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Plot(antialias=3, axes=['x', 'y', 'z'], axes_helper=1.0, background_color=16777215, camera=[0.5632771544478462…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"\"\"\"\n",
"Draw the PCA (Principal Component Analysis) ellipsoid that contains\n",
Expand All @@ -52,27 +26,20 @@
"vp += Points(ipts, c=\"g\")\n",
"vp += Points(opts, c=\"r\")\n",
"\n",
"printc(\"inside points #\", len(ipts), c='g')\n",
"printc(\"outside points #\", len(opts), c='r')\n",
"printc(\"inside points #\", ipts.N(), c='g')\n",
"printc(\"outside points #\", opts.N(), c='r')\n",
"printc(\"a-sphericity:\", elli.asphericity())\n",
"vp.show()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"closePlotter()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
# rm examples/other/voronoi3d.txt examples/other/voronoi3d.txt.vol
# rm examples/other/embryo.html examples/other/embryo.x3d

# comment out defs in docs.py

# git status
# git add [files]
# git commit -a -m 'comment'
Expand All @@ -98,6 +100,7 @@
# release examples

## to generate documentation:
# comment in defs in docs.py
# Install the dependencies in docs/requirements.txt
# pip install -r docs/requirements.txt
#
Expand Down
17 changes: 7 additions & 10 deletions tests/dolfinx/test_aaa.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
import numpy as np
from petsc4py import PETSc

import dolfin
from dolfin import (MPI, BoxMesh, DirichletBC, Function, VectorFunctionSpace,
cpp)
from dolfin.cpp.mesh import CellType
from dolfin.fem import apply_lifting, assemble_matrix, assemble_vector, set_bc
import dolfinx
from dolfinx import (MPI, UnitCubeMesh,
DirichletBC, Function, VectorFunctionSpace, cpp)
from dolfinx.cpp.mesh import CellType
from dolfinx.fem import apply_lifting, assemble_matrix, assemble_vector, set_bc
#from dolfin.io import XDMFFile
from dolfin.la import VectorSpaceBasis
from dolfinx.la import VectorSpaceBasis
from ufl import (Identity, SpatialCoordinate, TestFunction, TrialFunction,
as_vector, dx, grad, inner, sym, tr)

Expand Down Expand Up @@ -67,7 +67,7 @@ def build_nullspace(V):
# MPI.comm_world, [np.array([0.0, 0.0, 0.0]),
# np.array([2.0, 1.0, 1.0])], [12, 12, 12],
# CellType.tetrahedron, dolfin.cpp.mesh.GhostMode.none)
cmap = dolfin.fem.create_coordinate_map(mesh.ufl_domain())
cmap = dolfinx.fem.create_coordinate_map(mesh.ufl_domain())
mesh.geometry.coord_mapping = cmap

def boundary(x):
Expand Down Expand Up @@ -168,7 +168,6 @@ def sigma(v):
offscreen=1)

#################################################################################
import numpy as np
from vtkplotter import settings, screenshot
actor = settings.plotter_instance.actors[0]
solution = actor.scalars(0)
Expand All @@ -179,8 +178,6 @@ def sigma(v):
print('min', 'mean', 'max, N:')
print(np.min(solution), np.mean(solution), np.max(solution), len(solution))



# Plot solution
# import matplotlib.pyplot as plt
# import dolfin.plotting
Expand Down
1 change: 1 addition & 0 deletions vtkplotter/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def addScalarBar(mesh,
titprop.ShadowOff()
titprop.SetColor(c)
titprop.SetVerticalJustificationToTop()
titprop.SetFontSize(titleFontSize)
sb.SetTitle(title)
sb.SetVerticalTitleSeparation(titleYOffset)
sb.SetTitleTextProperty(titprop)
Expand Down
Loading

0 comments on commit 4a6c7e6

Please sign in to comment.