Skip to content

Extract Boundary

ameli edited this page Jan 26, 2013 · 13 revisions

Introduction

This package has been created to facilitate ParaView users that interact with two dimensional data grids. This package is utilized as a ParaView plugin, so the end users could take advantage of it as a new Filter. The Extract Boundary filter extracts boundaries of a 2D grid. It is robust to concave geometries, unusual cell links in a boundary point and acute and narrow bay-like shapes. Furthermore, user may opt for extracting all inner boundaries, such as lakes. This filter also identifies points with zero velocity. Inward or outward normal vectors are also calculated at each point.

The program accepts various grid types such as structured or unstructured grids. Also it works well with different two dimensional cell types, for instance triangular, polygons, etc. Moreover, multiple file formats as supported. Common file formats are legacy *.vtk and binary *.vtu extensions.

Build Source

User can build the code from source. You can obtain the source code from github repository. Please install git package:

sudo apt-get install git

Then, create a build directory and download the source code inside the build directory:

$ mkdir /tmp/ExtractBoundary
$ cd /tmp/ExtractBoundary
$ git clone git://github.com/ameli/extract-boundary

Now, build the code:

$ cmake .
$ make
$ sudo make install
$ cd ..
$ rm -r /tmp/ExtractBoundary

Installation is system-wide for all users.

Install Binary

You may use binary package instead of building code from source. Binary installation is available for Ubuntu operating system. Follow these commands in Ubuntu terminal:

$ sudo add-apt-repository ppa:ameli/extractboundary
$ sudo apt-get update
$ sudo apt-get install extractboundary

Options

Filter has the following options:

  • Search Boundary Mode can be Outer boundary or outer and all inner boundaries. Default is on searching only outer boundaries, which is O(sqrt(n)). Inner and outer boundary search is in order of O(n).
  • Extract Velocity Boundary is boolean. Default is on true.
  • Calculate Normals is boolean. Default value is set to true.
  • Normals Outward is boolean. Default value is set to false.

Program Usage

You can use the program either in terminal or as a ParaView plugin. Here are examples to use it in terminal:

$ extractboundary /input-path/inputfile.vtk /output-path/outputfile.vtk

You can also define only output filename without path. In this case, program writes output file in the same directory of input path.

$ extractboundary /input-path/inputfile.vtk outputfile.vtk

You may not define any path. So it considers the current directory for both input and output path:

$ extractboundary inputfile.vtk outputfile.vtk

If user do not specify output file, it writes output file with the same name as input file name with a -boundary suffix and the same file extension of input file.

$ extractboundary /input-path/inputfile.vtk

or

$ extractboundary inputfile.vtk

In this case, output file name would be inputfile-boundary.vtk.

For help, use -h, for get program information use -i and for see the license, use -l options.

$ extractboundary -h
$ extractboundary -i
$ extractboundary -l

A sample vtk output file is similar to the following:

# vtk DataFile Version 3.0
vtk output
ASCII
DATASET POLYDATA
POINTS 55 float
4 14 0 1 12 0 2 11 0
1 10 0 1 9 0 2 8 0
3 6 0 2 5 0 4 2 0
...

VERTICES 55 110
1 0
1 1
1 2
...

POLYGONS 3 30
14 0 1 2 3 4 5 6 7 8 9 10 11 12 13
8 26 27 28 29 30 31 32 33
8 34 35 36 37 38 39 40 41

POINT_DATA 55
NORMALS NormalVectors double
0.0621374 -0.998068 0 0.995133 -0.0985376 0 1 0 0
0.92388 -0.382683 0 0.92388 0.382683 0 0.811242 0.58471 0
0.987087 -0.160182 0 0.995133 -0.0985376 0 0.471858 0.881675 0
...

FIELD FieldData 1
VelocityBoundary 1 55 unsigned_int
0 1 1 1 0 0 0 0 0
0 0 0 0 0 0 0 1 1
1 0 0 0 0 0 0 0 0
...

ParaView Plugin Usage

Figures \ref{png-1} to \ref{png-4} show how to load the plugin and use it. Also Figures \ref{pdf-1} to \ref{pdf-6} illistrate how the filter is implemented on a 2D unstructured grid.

Options of the filter in Properties toolbar

Manage Plugins

Plugin Manager

Find Extract Boundary filter in Extention sub-menu

An unstructured 2D grid with cavities, bay and acute boundary edges

Outer boundary is extracted from rest of the grid

Outer and all inner boundaries are extracted from rest of the grid

Points with red colors are zero velocity points. Blue points have non zero velocities.

Inward Normal vectors at each boundary point

Outward Normal vectors at each boundary point

License

Copyright 2013 Siavash Ameli

This source code is provided as-is, without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for non commercial purpose, to alter it and redistribute it freely, subject to the following restrictions:

  • The origin of this source code must not be misrepresented; you must not claim that you wrote the original source code.
  • You may modify or alter the source code at your own risk, provided that such modifications are extensively commented. Altered source versions must not be misrepresented as being the original source code.
  • Source code may not be redistributed in any way. You may distribute the target binary for non-commercial purposes.
  • If you use this source code in a non-commercial product, an acknowledgment in the product documentation would be appreciated.
  • This notice may not be removed or altered from any source distribution.

Bug Report

Any bug reports and comments are appreciated. You may report bugs in github, Launchpad.

Acknowledgement

This work was supported by the National Science Foundation, award number 1047963.