<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://e6.ijs.si/medusa/wiki/api.php?action=feedcontributions&amp;user=Jureslak&amp;feedformat=atom</id>
		<title>Medusa: Coordinate Free Mehless Method implementation - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://e6.ijs.si/medusa/wiki/api.php?action=feedcontributions&amp;user=Jureslak&amp;feedformat=atom"/>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php/Special:Contributions/Jureslak"/>
		<updated>2026-04-10T13:53:27Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.1</generator>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3155</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3155"/>
				<updated>2020-11-19T10:31:31Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Working with 3D models in Medusa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors can be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure. Note that the polyhedron, represented in the OFF file is considered to be the exact domain, which is then discretize with meshless techniques. The mesh is used only to define the domain, and is considered fixed and final. Discretizations can (and usually should) be smaller than.&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the bunny OFF model with surface nodes of various types, as defined by the face colors, along with the surface normals.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-surface.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;PolytopeShape&amp;lt;/code&amp;gt; (a dimension independent version of &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;PolygonShape&amp;lt;/code&amp;gt;) can be used to work with OFF files. Otherwise, the solution procedure is as usual.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;medusa/bits/domains/PolyhedronShape.hpp&amp;gt;  // This must be included separately.&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
    std::string filename = &amp;quot;bunny.off&amp;quot;;&lt;br /&gt;
    PolytopeShape&amp;lt;Vec3d&amp;gt; bunny = PolytopeShape&amp;lt;Vec3d&amp;gt;::fromOFF(filename);&lt;br /&gt;
&lt;br /&gt;
    double dx = 2.5;&lt;br /&gt;
    DomainDiscretization&amp;lt;Vec3d&amp;gt; domain = bunny.discretizeBoundaryWithStep(dx);&lt;br /&gt;
    GeneralFill&amp;lt;Vec3d&amp;gt; fill; fill.seed(0);&lt;br /&gt;
    fill(domain, dx);&lt;br /&gt;
&lt;br /&gt;
    ... // The usual.&lt;br /&gt;
&lt;br /&gt;
    for (int i : domain.interior()) {&lt;br /&gt;
        0.1*op.grad(i, -1) + 2.0*op.lap(i) = -1.0;&lt;br /&gt;
    }&lt;br /&gt;
    for (int i : domain.boundary()) {&lt;br /&gt;
        op.value(i) = 0.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Eigen::BiCGSTAB&amp;lt;decltype(M), Eigen::IncompleteLUT&amp;lt;double&amp;gt;&amp;gt; solver;&lt;br /&gt;
    solver.preconditioner().setDroptol(1e-4);&lt;br /&gt;
    solver.preconditioner().setFillfactor(20);&lt;br /&gt;
    solver.compute(M);&lt;br /&gt;
    ScalarFieldd u = solver.solve(rhs);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The solution is shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-sol2.png|496px]]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3154</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3154"/>
				<updated>2020-11-19T10:31:16Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Working with 3D models in Medusa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors can be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure. Note that the polyhedron, represented in the OFF file is considered to be the exact domain, which is then discretize with meshless techniques. The mesh is used only to define the domain, and is considered fixed and final. Discretizations can (and usually should) be smaller than.&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the bunny OFF model with surface nodes of various types, as defined by the face colors, along with the surface normals.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-surface.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;PolytopeShape&amp;lt;/code&amp;gt; (a dimension independent version of &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;PolygonShape&amp;lt;/code&amp;gt;) can be used to work with OFF files. Otherwise, the solution procedure is as usual.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;medusa/bits/domains/PolyhedronShape.hpp&amp;gt;  // This must be included separately.&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
    std::string filename = &amp;quot;bunny.off&amp;quot;;&lt;br /&gt;
    PolytopeShape&amp;lt;Vec3d&amp;gt; bunny = PolytopeShape&amp;lt;Vec3d&amp;gt;::fromOFF(filename);&lt;br /&gt;
&lt;br /&gt;
    double dx = 2.5;&lt;br /&gt;
    DomainDiscretization&amp;lt;Vec3d&amp;gt; domain = bunny.discretizeBoundaryWithStep(dx);&lt;br /&gt;
    GeneralFill&amp;lt;Vec3d&amp;gt; fill; fill.seed(0);&lt;br /&gt;
    fill(domain, dx);&lt;br /&gt;
&lt;br /&gt;
    ... // The usual.&lt;br /&gt;
&lt;br /&gt;
    for (int i : domain.interior()) {&lt;br /&gt;
        0.1*op.grad(i, -1) + 2.0*op.lap(i) = -1.0;&lt;br /&gt;
    }&lt;br /&gt;
    for (int i : domain.boundary()) {&lt;br /&gt;
        op.value(i) = 0.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Eigen::BiCGSTAB&amp;lt;decltype(M), Eigen::IncompleteLUT&amp;lt;double&amp;gt;&amp;gt; solver;&lt;br /&gt;
    solver.preconditioner().setDroptol(1e-4);&lt;br /&gt;
    solver.preconditioner().setFillfactor(20);&lt;br /&gt;
    solver.compute(M);&lt;br /&gt;
    ScalarFieldd u = solver.solve(rhs);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The solution is shown below:&lt;br /&gt;
[[File:bunny-sol2.png|496px]]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3153</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3153"/>
				<updated>2020-11-19T10:28:52Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Working with 3D models in Medusa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors can be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure. Note that the polyhedron, represented in the OFF file is considered to be the exact domain, which is then discretize with meshless techniques. The mesh is used only to define the domain, and is considered fixed and final. Discretizations can (and usually should) be smaller than.&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the bunny OFF model with surface nodes of various types, as defined by the face colors, along with the surface normals.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-surface.png|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;medusa/bits/domains/PolyhedronShape.hpp&amp;gt;  // This must be included separately.&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
    std::string filename = &amp;quot;bunny.off&amp;quot;;&lt;br /&gt;
    PolytopeShape&amp;lt;Vec3d&amp;gt; bunny = PolytopeShape&amp;lt;Vec3d&amp;gt;::fromOFF(filename);&lt;br /&gt;
&lt;br /&gt;
    double dx = 2.5;&lt;br /&gt;
    DomainDiscretization&amp;lt;Vec3d&amp;gt; domain = bunny.discretizeBoundaryWithStep(dx);&lt;br /&gt;
    GeneralFill&amp;lt;Vec3d&amp;gt; fill; fill.seed(0);&lt;br /&gt;
    fill(domain, dx);&lt;br /&gt;
&lt;br /&gt;
    int N = domain.size();&lt;br /&gt;
    domain.findSupport(FindClosest(25));&lt;br /&gt;
    RBFFD&amp;lt;Polyharmonic&amp;lt;double, 3&amp;gt;, Vec3d, ScaleToClosest&amp;gt; approx({}, 2);&lt;br /&gt;
    auto storage = domain.template computeShapes&amp;lt;sh::lap|sh::d1&amp;gt;(approx);&lt;br /&gt;
&lt;br /&gt;
    Eigen::SparseMatrix&amp;lt;double, Eigen::RowMajor&amp;gt; M(N, N);&lt;br /&gt;
    Eigen::VectorXd rhs(N); rhs.setZero();&lt;br /&gt;
&lt;br /&gt;
    auto op = storage.implicitOperators(M, rhs);&lt;br /&gt;
    M.reserve(storage.supportSizes());&lt;br /&gt;
&lt;br /&gt;
    for (int i : domain.interior()) {&lt;br /&gt;
        0.1*op.grad(i, -1) + 2.0*op.lap(i) = -1.0;&lt;br /&gt;
    }&lt;br /&gt;
    for (int i : domain.boundary()) {&lt;br /&gt;
        op.value(i) = 0.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Eigen::BiCGSTAB&amp;lt;decltype(M), Eigen::IncompleteLUT&amp;lt;double&amp;gt;&amp;gt; solver;&lt;br /&gt;
    solver.preconditioner().setDroptol(1e-4);&lt;br /&gt;
    solver.preconditioner().setFillfactor(20);&lt;br /&gt;
    solver.compute(M);&lt;br /&gt;
    ScalarFieldd u = solver.solve(rhs);&lt;br /&gt;
&lt;br /&gt;
    HDF hdf(&amp;quot;bunny_poisson.h5&amp;quot;, HDF::DESTROY);&lt;br /&gt;
    hdf.writeDouble2DArray(&amp;quot;pos&amp;quot;, domain.positions());&lt;br /&gt;
    hdf.writeEigen(&amp;quot;sol&amp;quot;, u);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-sol2.png|496px]]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3152</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3152"/>
				<updated>2020-11-19T10:28:31Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Working with 3D models in Medusa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors can be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure. Note that the polyhedron, represented in the OFF file is considered to be the exact domain, which is then discretize with meshless techniques. The mesh is used only to define the domain, and is considered fixed and final. Discretizations can (and usually should) be smaller than.&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the bunny OFF model with surface nodes of various types, as defined by the face colors, along with the surface normals.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-surface.png|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;medusa/bits/domains/PolyhedronShape.hpp&amp;gt;  // This must be included separately.&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
    std::string filename = &amp;quot;bunny.off&amp;quot;;&lt;br /&gt;
    PolytopeShape&amp;lt;Vec3d&amp;gt; bunny = PolytopeShape&amp;lt;Vec3d&amp;gt;::fromOFF(filename);&lt;br /&gt;
&lt;br /&gt;
    double dx = 2.5;&lt;br /&gt;
    DomainDiscretization&amp;lt;Vec3d&amp;gt; domain = bunny.discretizeBoundaryWithStep(dx);&lt;br /&gt;
    GeneralFill&amp;lt;Vec3d&amp;gt; fill; fill.seed(0);&lt;br /&gt;
    fill(domain, dx);&lt;br /&gt;
&lt;br /&gt;
    int N = domain.size();&lt;br /&gt;
    domain.findSupport(FindClosest(25));&lt;br /&gt;
    RBFFD&amp;lt;Polyharmonic&amp;lt;double, 3&amp;gt;, Vec3d, ScaleToClosest&amp;gt; approx({}, 2);&lt;br /&gt;
    auto storage = domain.template computeShapes&amp;lt;sh::lap|sh::d1&amp;gt;(approx);&lt;br /&gt;
&lt;br /&gt;
    Eigen::SparseMatrix&amp;lt;double, Eigen::RowMajor&amp;gt; M(N, N);&lt;br /&gt;
    Eigen::VectorXd rhs(N); rhs.setZero();&lt;br /&gt;
&lt;br /&gt;
    auto op = storage.implicitOperators(M, rhs);&lt;br /&gt;
    M.reserve(storage.supportSizes());&lt;br /&gt;
&lt;br /&gt;
    for (int i : domain.interior()) {&lt;br /&gt;
        0.1*op.grad(i, -1) + 2.0*op.lap(i) = -1.0;&lt;br /&gt;
    }&lt;br /&gt;
    for (int i : domain.boundary()) {&lt;br /&gt;
        op.value(i) = 0.0;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Eigen::BiCGSTAB&amp;lt;decltype(M), Eigen::IncompleteLUT&amp;lt;double&amp;gt;&amp;gt; solver;&lt;br /&gt;
    solver.preconditioner().setDroptol(1e-4);&lt;br /&gt;
    solver.preconditioner().setFillfactor(20);&lt;br /&gt;
    solver.compute(M);&lt;br /&gt;
    ScalarFieldd u = solver.solve(rhs);&lt;br /&gt;
&lt;br /&gt;
    HDF hdf(&amp;quot;bunny_poisson.h5&amp;quot;, HDF::DESTROY);&lt;br /&gt;
    hdf.writeDouble2DArray(&amp;quot;pos&amp;quot;, domain.positions());&lt;br /&gt;
    hdf.writeEigen(&amp;quot;sol&amp;quot;, u);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-sol2.png|500px]]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny-sol2.png&amp;diff=3151</id>
		<title>File:Bunny-sol2.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny-sol2.png&amp;diff=3151"/>
				<updated>2020-11-19T10:28:23Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Medusa&amp;diff=3150</id>
		<title>Medusa</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Medusa&amp;diff=3150"/>
				<updated>2020-11-18T14:58:42Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--__NOTITLE__--&amp;gt;&lt;br /&gt;
'''Welcome to the Medusa wiki. To visit the main website, go to [http://e6.ijs.si/medusa/ http://e6.ijs.si/medusa/].'''&lt;br /&gt;
&lt;br /&gt;
In [http://e6.ijs.si/ParallelAndDistributedSystems/ Parallel and Distributed Systems Laboratory] we are working on a C++ library that is first and foremost focused on tools for solving Partial Differential Equations by meshless methods. The basic idea is to create generic codes for tools that are needed for solving not only PDEs but many other problems, e.g. Moving Least Squares approximation, $k$-d tree, domain generation engines, etc.&lt;br /&gt;
We call this open source meshless project [http://e6.ijs.si/medusa/ Medusa: Coordinate Free Meshless Method implementation (MM)].&lt;br /&gt;
&lt;br /&gt;
Technical details about code and examples  can be found on our [http://e6.ijs.si/medusa/docs/ documentation page] and [https://gitlab.com/e62Lab/medusa Gitlab repository]. [[File:C.png|100px||link=https://gitlab.com/e62Lab/medusa|alt=Alt text|code]] [[File:doxygen.png|100px|link=http://e6.ijs.si/medusa/docs/|alt=Alt text|Documentation page]]&lt;br /&gt;
&lt;br /&gt;
This wiki site is meant for more relaxed discussions about general principles, possible and already implemented applications, preliminary analyses, etc.&lt;br /&gt;
Note, that there are many grammatical mistakes, typos, stupid sentences, etc. This wiki is meant for quick information exchange and therefore we do not invest a lot of energy into styling :).  &lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [https://gitlab.com/e62Lab/medusa Code on Gitlab]&lt;br /&gt;
* [[How to build | Installation and building]]&lt;br /&gt;
* [[Including this library in your project | Including this library in your project]]&lt;br /&gt;
* [[Testing | Running tests]]&lt;br /&gt;
* [http://e6.ijs.si/medusa/docs/ Technical documentation]&lt;br /&gt;
* [[Coding style | Coding style]]&lt;br /&gt;
* [[Wiki editing guide | Wiki editing and backup guide]]&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
In this section we present exact examples. Each of the below solutions can be found also in in the repository under examples. More explanation about the physical background and solution procedure can be found in following sections.&lt;br /&gt;
* [[Philosophy of examples and how to run them]]&lt;br /&gt;
* [[Poisson's equation]]&lt;br /&gt;
* [[Heat equation]]&lt;br /&gt;
* [[Linear elasticity]]&lt;br /&gt;
* [[Complex-valued problems]]&lt;br /&gt;
* [[Coupled domains]]&lt;br /&gt;
* [[Parametric domains | Parametric domains &amp;amp;ndash; Curved surface with variable density]]&lt;br /&gt;
* [[NURBS domains | Domains modeled with non-uniform rational basis spline's (NURBS)]]&lt;br /&gt;
* [[Realistic 3D models]]&lt;br /&gt;
* [[Customization]]&lt;br /&gt;
* [[Ghost nodes]]&lt;br /&gt;
* [[Electromagnetic scattering]]&lt;br /&gt;
* [[Schrödinger equation]]&lt;br /&gt;
* [[Wave equation]]&lt;br /&gt;
* [[Cahn-Hilliard equation]]&lt;br /&gt;
* [[Non-Newtonian_fluid_example | Non-Newtonian fluid]]&lt;br /&gt;
* [[Meshless Lattice Boltzmann method]]&lt;br /&gt;
&lt;br /&gt;
== Building blocks ==&lt;br /&gt;
Medusa is modular coordinate-free parallel implementation of a numerical framework designed, but not limited to, for solving PDEs. In this section we present main modules of the library that can be also used as a standalone tools. &lt;br /&gt;
* [[Positioning of computational nodes]] &lt;br /&gt;
* [[Relaxation of the nodal distribution]]&lt;br /&gt;
* [[Refinement of the nodal distribution]]&lt;br /&gt;
* [[k-d tree|''k''-d tree]] and other spatial search structures&lt;br /&gt;
* Solving [[Solving linear systems | linear systems]], [[Solving overdetermined systems | overdetermined]] and [[Solving underdetermined systems | underdetermined]]&lt;br /&gt;
* [[Weighted Least Squares (WLS)]]&lt;br /&gt;
* [[Computation of shape functions]]&lt;br /&gt;
* [[Meshless Local Strong Form Method (MLSM)]]&lt;br /&gt;
* [[Radial basis function-generated finite differences (RBF-FD)]]&lt;br /&gt;
* [[Ghost nodes (theory)]]&lt;br /&gt;
* [[Integrators for time stepping]]&lt;br /&gt;
* [[RBF Interpolation]]&lt;br /&gt;
&lt;br /&gt;
== Discussions / Applications ==&lt;br /&gt;
This section is meant for general discussion about the physical background of the examples, the solution procedures, various applications, etc. Note, that code snippets presented in discussion might not reflect the actual state of Medusa.  &lt;br /&gt;
* Basic PDE solutions&lt;br /&gt;
** [[Convection Diffusion equation | Convection Diffusion equation]]&lt;br /&gt;
**[[Wave equation application]] &lt;br /&gt;
* [[Adaptivity]]&lt;br /&gt;
* [[Solid Mechanics]]&lt;br /&gt;
** [[Point contact]]&lt;br /&gt;
** [[Hertzian contact]]&lt;br /&gt;
** [[Cantilever beam]]&lt;br /&gt;
** [[Fretting fatigue case]]&lt;br /&gt;
* [[Fluid Mechanics]]&lt;br /&gt;
** [[Lid driven cavity]]&lt;br /&gt;
** [[de Vahl Davis natural convection test]]&lt;br /&gt;
** [[Natural convection in 3D irregular domain]]&lt;br /&gt;
** [[Natural convection from heated cylinder]]&lt;br /&gt;
** [[Natural convection between concentric cylinders]]&lt;br /&gt;
** [[Non-Newtonian fluid]]&lt;br /&gt;
* [[Computational electromagnetics]]&lt;br /&gt;
** [[Triple dielectric step in 1D]]&lt;br /&gt;
** [[Scattering from an infinite cylinder]]&lt;br /&gt;
** [[Point source near an anisotropic lens]]&lt;br /&gt;
* Other applications&lt;br /&gt;
** [[Attenuation due to liquid water content in the atmosphere|Attenuation of a satellite communication]]&lt;br /&gt;
** [[Heart rate variability detection]]&lt;br /&gt;
** [[Bioheat equation]]&lt;br /&gt;
&lt;br /&gt;
== Performance analyses ==&lt;br /&gt;
* [[Execution on Intel® Xeon Phi™ co-processor]]&lt;br /&gt;
* [[1D MLSM and FDM comparison]]&lt;br /&gt;
* [[:File:tech_report.pdf|Execution overheads due to clumsy types::technical report]] [[File:pdf-file.gif]]&lt;br /&gt;
* [[Solving sparse systems]]&lt;br /&gt;
* [[Eigen paralelization]]&lt;br /&gt;
&lt;br /&gt;
== Last changes ==&lt;br /&gt;
&amp;lt;news unique=1 limit = 5&amp;gt;&lt;br /&gt;
*{{{timeanddate}}} :: {{{title}}} &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/news&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
* FAQ  - [[Frequently asked questions]]. &lt;br /&gt;
* [[List of wiki contributors]]&lt;br /&gt;
* List of library contributors: [http://e6.ijs.si/medusa/about#about-contributors See the official website]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Slak J., Kosec G. Adaptive radial basis function-generated finite differences method for contact problems. International journal for numerical methods in engineering, ISSN 0029-5981 [http://www-e6.ijs.si/ParallelAndDistributedSystems/pdf/32230439.pdf manuscript]&lt;br /&gt;
* Slak J., Kosec G.; Refined meshless local strong form solution of Cauchy-Navier equation on an irregular domain. Engineering analysis with boundary elements. 2018;11 ; [http://comms.ijs.si/~gkosec/data/papers/31107623.pdf manuscript]&lt;br /&gt;
* Depolli, M., Kosec, G., Assessment of differential evolution for multi-objective optimization in a natural convection problem solved by a local meshless method. Engineering optimization, 2017, vol. 49, no. 4, pp. 675-692 ;[http://comms.ijs.si/~gkosec/data/papers/29639719.pdf manuscript]&lt;br /&gt;
* Kosec G., A local numerical solution of a fluid-flow problem on an irregular domain. Advances in engineering software. 2016;7 ; [29512743] ; [http://comms.ijs.si/~gkosec/data/papers/29512743.pdf manuscript]&lt;br /&gt;
* Kosec G., Trobec R., Simulation of semiconductor devices with a local numerical approach. Engineering analysis with boundary elements. 2015;69-75; [27912487] ; [http://comms.ijs.si/~gkosec/data/papers/27912487.pdf manuscript]&lt;br /&gt;
* Kosec G., Šarler B., Simulation of macrosegregation with mesosegregates in binary metallic casts by a meshless method. Engineering analysis with boundary elements. 2014;36-44; [http://comms.ijs.si/~gkosec/data/papers/3218939.pdf manuscript]&lt;br /&gt;
* Kosec G., Depolli M., Rashkovska A., Trobec R., Super linear speedup in a local parallel meshless solution of thermo-fluid problem. Computers &amp;amp; Structures. 2014;133:30-38; [http://comms.ijs.si/~gkosec/data/papers/27339815.pdf manuscript]&lt;br /&gt;
* Kosec G., Zinterhof P., Local strong form meshless method on multiple Graphics Processing Units. Computer modeling in engineering &amp;amp; sciences. 2013;91:377-396; [http://comms.ijs.si/~gkosec/data/papers/26785063.pdf manuscript]&lt;br /&gt;
* Kosec G., Šarler B., H-adaptive local radial basis function collocation meshless method. Computers, materials &amp;amp; continua. 2011;26:227-253; [http://comms.ijs.si/~gkosec/data/papers/KosecSarlerBurgers.pdf manuscript]&lt;br /&gt;
* Trobec R., Kosec G., Šterk M., Šarler B., Comparison of local weak and strong form meshless methods for 2-D diffusion equation. Engineering analysis with boundary elements. 2012;36:310-321; [http://comms.ijs.si/~gkosec/data/papers/EABE2499.pdf manuscript]&lt;br /&gt;
* Kosec G, Zaloznik M, Sarler B, Combeau H. A Meshless Approach Towards Solution of Macrosegregation Phenomena. CMC: Computers, Materials, &amp;amp; Continua. 2011;580:1-27 [http://comms.ijs.si/~gkosec/data/papers/KosecZaloznikSarlerCombeauSegregation.pdf manuscript]&lt;br /&gt;
* Kosec G, Sarler B. Solution of thermo-fluid problems by collocation with local pressure correction. International Journal of Numerical Methods for Heat &amp;amp; Fluid Flow. 2008;18:868-82 [http://comms.ijs.si/~gkosec/data/papers/KosecSarlerNS2008.pdf manuscript]&lt;br /&gt;
*  Trobec R., Kosec G., Parallel Scientific Computing, ISBN: 978-3-319-17072-5 (Print) 978-3-319-17073-2.&lt;br /&gt;
*  Slak, J., Kosec, G.. Detection of heart rate variability from a wearable differential ECG device., MIPRO 2016, 39th International Convention, 2016, Opatija, Croatia, ISSN 1847-3938, pp 450-455.&lt;br /&gt;
*  Kolman, M., Kosec, G. Correlation between attenuation of 20 GHz satellite communication link and liquid water content in the atmosphere. MIPRO 2016, 39th International Convention, 2016, Opatija, Croatia, ISSN 1847-3938. pp. 308-313.&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
* http://e6.ijs.si/ParallelAndDistributedSystems/#!NumericalMethods&lt;br /&gt;
* http://e6.ijs.si/ParallelAndDistributedSystems/#!utils&lt;br /&gt;
* http://e6.ijs.si/ParallelAndDistributedSystems/#!NUMA&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3149</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3149"/>
				<updated>2020-11-18T14:58:28Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: Jureslak moved page Complicated 3D models to Realistic 3D models without leaving a redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors can be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure. Note that the polyhedron, represented in the OFF file is considered to be the exact domain, which is then discretize with meshless techniques. The mesh is used only to define the domain, and is considered fixed and final. Discretizations can (and usually should) be smaller than.&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the bunny OFF model with surface nodes of various types, as defined by the face colors, along with the surface normals.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-surface.png|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-sol.png|400px]]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3148</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3148"/>
				<updated>2020-11-18T14:57:55Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: Jureslak moved page Complex 3D models to Complicated 3D models without leaving a redirect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors can be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure. Note that the polyhedron, represented in the OFF file is considered to be the exact domain, which is then discretize with meshless techniques. The mesh is used only to define the domain, and is considered fixed and final. Discretizations can (and usually should) be smaller than.&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the bunny OFF model with surface nodes of various types, as defined by the face colors, along with the surface normals.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-surface.png|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-sol.png|400px]]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Medusa&amp;diff=3147</id>
		<title>Medusa</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Medusa&amp;diff=3147"/>
				<updated>2020-11-18T14:57:29Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--__NOTITLE__--&amp;gt;&lt;br /&gt;
'''Welcome to the Medusa wiki. To visit the main website, go to [http://e6.ijs.si/medusa/ http://e6.ijs.si/medusa/].'''&lt;br /&gt;
&lt;br /&gt;
In [http://e6.ijs.si/ParallelAndDistributedSystems/ Parallel and Distributed Systems Laboratory] we are working on a C++ library that is first and foremost focused on tools for solving Partial Differential Equations by meshless methods. The basic idea is to create generic codes for tools that are needed for solving not only PDEs but many other problems, e.g. Moving Least Squares approximation, $k$-d tree, domain generation engines, etc.&lt;br /&gt;
We call this open source meshless project [http://e6.ijs.si/medusa/ Medusa: Coordinate Free Meshless Method implementation (MM)].&lt;br /&gt;
&lt;br /&gt;
Technical details about code and examples  can be found on our [http://e6.ijs.si/medusa/docs/ documentation page] and [https://gitlab.com/e62Lab/medusa Gitlab repository]. [[File:C.png|100px||link=https://gitlab.com/e62Lab/medusa|alt=Alt text|code]] [[File:doxygen.png|100px|link=http://e6.ijs.si/medusa/docs/|alt=Alt text|Documentation page]]&lt;br /&gt;
&lt;br /&gt;
This wiki site is meant for more relaxed discussions about general principles, possible and already implemented applications, preliminary analyses, etc.&lt;br /&gt;
Note, that there are many grammatical mistakes, typos, stupid sentences, etc. This wiki is meant for quick information exchange and therefore we do not invest a lot of energy into styling :).  &lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [https://gitlab.com/e62Lab/medusa Code on Gitlab]&lt;br /&gt;
* [[How to build | Installation and building]]&lt;br /&gt;
* [[Including this library in your project | Including this library in your project]]&lt;br /&gt;
* [[Testing | Running tests]]&lt;br /&gt;
* [http://e6.ijs.si/medusa/docs/ Technical documentation]&lt;br /&gt;
* [[Coding style | Coding style]]&lt;br /&gt;
* [[Wiki editing guide | Wiki editing and backup guide]]&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
In this section we present exact examples. Each of the below solutions can be found also in in the repository under examples. More explanation about the physical background and solution procedure can be found in following sections.&lt;br /&gt;
* [[Philosophy of examples and how to run them]]&lt;br /&gt;
* [[Poisson's equation]]&lt;br /&gt;
* [[Heat equation]]&lt;br /&gt;
* [[Linear elasticity]]&lt;br /&gt;
* [[Complex-valued problems]]&lt;br /&gt;
* [[Coupled domains]]&lt;br /&gt;
* [[Parametric domains | Parametric domains &amp;amp;ndash; Curved surface with variable density]]&lt;br /&gt;
* [[NURBS domains | Domains modeled with non-uniform rational basis spline's (NURBS)]]&lt;br /&gt;
* [[Complicated 3D models]]&lt;br /&gt;
* [[Customization]]&lt;br /&gt;
* [[Ghost nodes]]&lt;br /&gt;
* [[Electromagnetic scattering]]&lt;br /&gt;
* [[Schrödinger equation]]&lt;br /&gt;
* [[Wave equation]]&lt;br /&gt;
* [[Cahn-Hilliard equation]]&lt;br /&gt;
* [[Non-Newtonian_fluid_example | Non-Newtonian fluid]]&lt;br /&gt;
* [[Meshless Lattice Boltzmann method]]&lt;br /&gt;
&lt;br /&gt;
== Building blocks ==&lt;br /&gt;
Medusa is modular coordinate-free parallel implementation of a numerical framework designed, but not limited to, for solving PDEs. In this section we present main modules of the library that can be also used as a standalone tools. &lt;br /&gt;
* [[Positioning of computational nodes]] &lt;br /&gt;
* [[Relaxation of the nodal distribution]]&lt;br /&gt;
* [[Refinement of the nodal distribution]]&lt;br /&gt;
* [[k-d tree|''k''-d tree]] and other spatial search structures&lt;br /&gt;
* Solving [[Solving linear systems | linear systems]], [[Solving overdetermined systems | overdetermined]] and [[Solving underdetermined systems | underdetermined]]&lt;br /&gt;
* [[Weighted Least Squares (WLS)]]&lt;br /&gt;
* [[Computation of shape functions]]&lt;br /&gt;
* [[Meshless Local Strong Form Method (MLSM)]]&lt;br /&gt;
* [[Radial basis function-generated finite differences (RBF-FD)]]&lt;br /&gt;
* [[Ghost nodes (theory)]]&lt;br /&gt;
* [[Integrators for time stepping]]&lt;br /&gt;
* [[RBF Interpolation]]&lt;br /&gt;
&lt;br /&gt;
== Discussions / Applications ==&lt;br /&gt;
This section is meant for general discussion about the physical background of the examples, the solution procedures, various applications, etc. Note, that code snippets presented in discussion might not reflect the actual state of Medusa.  &lt;br /&gt;
* Basic PDE solutions&lt;br /&gt;
** [[Convection Diffusion equation | Convection Diffusion equation]]&lt;br /&gt;
**[[Wave equation application]] &lt;br /&gt;
* [[Adaptivity]]&lt;br /&gt;
* [[Solid Mechanics]]&lt;br /&gt;
** [[Point contact]]&lt;br /&gt;
** [[Hertzian contact]]&lt;br /&gt;
** [[Cantilever beam]]&lt;br /&gt;
** [[Fretting fatigue case]]&lt;br /&gt;
* [[Fluid Mechanics]]&lt;br /&gt;
** [[Lid driven cavity]]&lt;br /&gt;
** [[de Vahl Davis natural convection test]]&lt;br /&gt;
** [[Natural convection in 3D irregular domain]]&lt;br /&gt;
** [[Natural convection from heated cylinder]]&lt;br /&gt;
** [[Natural convection between concentric cylinders]]&lt;br /&gt;
** [[Non-Newtonian fluid]]&lt;br /&gt;
* [[Computational electromagnetics]]&lt;br /&gt;
** [[Triple dielectric step in 1D]]&lt;br /&gt;
** [[Scattering from an infinite cylinder]]&lt;br /&gt;
** [[Point source near an anisotropic lens]]&lt;br /&gt;
* Other applications&lt;br /&gt;
** [[Attenuation due to liquid water content in the atmosphere|Attenuation of a satellite communication]]&lt;br /&gt;
** [[Heart rate variability detection]]&lt;br /&gt;
** [[Bioheat equation]]&lt;br /&gt;
&lt;br /&gt;
== Performance analyses ==&lt;br /&gt;
* [[Execution on Intel® Xeon Phi™ co-processor]]&lt;br /&gt;
* [[1D MLSM and FDM comparison]]&lt;br /&gt;
* [[:File:tech_report.pdf|Execution overheads due to clumsy types::technical report]] [[File:pdf-file.gif]]&lt;br /&gt;
* [[Solving sparse systems]]&lt;br /&gt;
* [[Eigen paralelization]]&lt;br /&gt;
&lt;br /&gt;
== Last changes ==&lt;br /&gt;
&amp;lt;news unique=1 limit = 5&amp;gt;&lt;br /&gt;
*{{{timeanddate}}} :: {{{title}}} &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/news&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
* FAQ  - [[Frequently asked questions]]. &lt;br /&gt;
* [[List of wiki contributors]]&lt;br /&gt;
* List of library contributors: [http://e6.ijs.si/medusa/about#about-contributors See the official website]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Slak J., Kosec G. Adaptive radial basis function-generated finite differences method for contact problems. International journal for numerical methods in engineering, ISSN 0029-5981 [http://www-e6.ijs.si/ParallelAndDistributedSystems/pdf/32230439.pdf manuscript]&lt;br /&gt;
* Slak J., Kosec G.; Refined meshless local strong form solution of Cauchy-Navier equation on an irregular domain. Engineering analysis with boundary elements. 2018;11 ; [http://comms.ijs.si/~gkosec/data/papers/31107623.pdf manuscript]&lt;br /&gt;
* Depolli, M., Kosec, G., Assessment of differential evolution for multi-objective optimization in a natural convection problem solved by a local meshless method. Engineering optimization, 2017, vol. 49, no. 4, pp. 675-692 ;[http://comms.ijs.si/~gkosec/data/papers/29639719.pdf manuscript]&lt;br /&gt;
* Kosec G., A local numerical solution of a fluid-flow problem on an irregular domain. Advances in engineering software. 2016;7 ; [29512743] ; [http://comms.ijs.si/~gkosec/data/papers/29512743.pdf manuscript]&lt;br /&gt;
* Kosec G., Trobec R., Simulation of semiconductor devices with a local numerical approach. Engineering analysis with boundary elements. 2015;69-75; [27912487] ; [http://comms.ijs.si/~gkosec/data/papers/27912487.pdf manuscript]&lt;br /&gt;
* Kosec G., Šarler B., Simulation of macrosegregation with mesosegregates in binary metallic casts by a meshless method. Engineering analysis with boundary elements. 2014;36-44; [http://comms.ijs.si/~gkosec/data/papers/3218939.pdf manuscript]&lt;br /&gt;
* Kosec G., Depolli M., Rashkovska A., Trobec R., Super linear speedup in a local parallel meshless solution of thermo-fluid problem. Computers &amp;amp; Structures. 2014;133:30-38; [http://comms.ijs.si/~gkosec/data/papers/27339815.pdf manuscript]&lt;br /&gt;
* Kosec G., Zinterhof P., Local strong form meshless method on multiple Graphics Processing Units. Computer modeling in engineering &amp;amp; sciences. 2013;91:377-396; [http://comms.ijs.si/~gkosec/data/papers/26785063.pdf manuscript]&lt;br /&gt;
* Kosec G., Šarler B., H-adaptive local radial basis function collocation meshless method. Computers, materials &amp;amp; continua. 2011;26:227-253; [http://comms.ijs.si/~gkosec/data/papers/KosecSarlerBurgers.pdf manuscript]&lt;br /&gt;
* Trobec R., Kosec G., Šterk M., Šarler B., Comparison of local weak and strong form meshless methods for 2-D diffusion equation. Engineering analysis with boundary elements. 2012;36:310-321; [http://comms.ijs.si/~gkosec/data/papers/EABE2499.pdf manuscript]&lt;br /&gt;
* Kosec G, Zaloznik M, Sarler B, Combeau H. A Meshless Approach Towards Solution of Macrosegregation Phenomena. CMC: Computers, Materials, &amp;amp; Continua. 2011;580:1-27 [http://comms.ijs.si/~gkosec/data/papers/KosecZaloznikSarlerCombeauSegregation.pdf manuscript]&lt;br /&gt;
* Kosec G, Sarler B. Solution of thermo-fluid problems by collocation with local pressure correction. International Journal of Numerical Methods for Heat &amp;amp; Fluid Flow. 2008;18:868-82 [http://comms.ijs.si/~gkosec/data/papers/KosecSarlerNS2008.pdf manuscript]&lt;br /&gt;
*  Trobec R., Kosec G., Parallel Scientific Computing, ISBN: 978-3-319-17072-5 (Print) 978-3-319-17073-2.&lt;br /&gt;
*  Slak, J., Kosec, G.. Detection of heart rate variability from a wearable differential ECG device., MIPRO 2016, 39th International Convention, 2016, Opatija, Croatia, ISSN 1847-3938, pp 450-455.&lt;br /&gt;
*  Kolman, M., Kosec, G. Correlation between attenuation of 20 GHz satellite communication link and liquid water content in the atmosphere. MIPRO 2016, 39th International Convention, 2016, Opatija, Croatia, ISSN 1847-3938. pp. 308-313.&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
* http://e6.ijs.si/ParallelAndDistributedSystems/#!NumericalMethods&lt;br /&gt;
* http://e6.ijs.si/ParallelAndDistributedSystems/#!utils&lt;br /&gt;
* http://e6.ijs.si/ParallelAndDistributedSystems/#!NUMA&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Coding_style&amp;diff=3146</id>
		<title>Coding style</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Coding_style&amp;diff=3146"/>
				<updated>2020-11-18T13:34:22Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a brief description of our coding style, roughtly following the [https://google.github.io/styleguide/cppguide.html Google C++ Style Guide]. &lt;br /&gt;
&lt;br /&gt;
You can also download the CLion settings: [[File:Settings.jar|thumb]], which you can import in &amp;lt;code&amp;gt;File/Import settings&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also download only our code style settings to import in CLion: [[:File:mm.xml]]. It can be imported under &amp;lt;code&amp;gt;Settings/Editor/Code Style/Scheme/Import scheme&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=General=&lt;br /&gt;
We use a 100 characters line width limit in C++ code.&lt;br /&gt;
&lt;br /&gt;
=Indentation=&lt;br /&gt;
&lt;br /&gt;
Indent using spaces. Indentation width is 4 spaces.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
for (int i = 0; i &amp;lt; 10; i++) {&lt;br /&gt;
    cout &amp;lt;&amp;lt; i &amp;lt;&amp;lt; endl;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Naming convention=&lt;br /&gt;
&lt;br /&gt;
Constants - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; UPPER_CASE &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
classes   - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;PascalCase&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
methods - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;camelCase&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
variables and stand-alone functions - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; underscore_separated &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
typedefs - lowercase underscore separated, usually one word with trailing &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; _t &amp;lt;/syntaxhighlight&amp;gt;, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; vec_t &amp;lt;/syntaxhighlight&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
namespaces - one lowercase word, maybe shortened, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; op &amp;lt;/syntaxhighlight&amp;gt;. For internal implementation details use &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; op_internal &amp;lt;/syntaxhighlight&amp;gt;. Namespace closing brace should contain comment  `// namespace your_name`. There is no indentation within namespaces.&lt;br /&gt;
&lt;br /&gt;
All standard abbreviations like [[Weighted Least Squares (WLS)]] or [https://en.wikipedia.org/wiki/Finite_element_method Finite Elements Method (FEM)] -&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;UPPER_CASE&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Floating point and integer literals use small suffixes, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; 0.0f, -1e8l, 45ull&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
#define MAX_VALUE 500&lt;br /&gt;
class MyClass {&lt;br /&gt;
  public:&lt;br /&gt;
    MyClass(first_var, second_var) {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
    int getSize();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Comments=&lt;br /&gt;
&lt;br /&gt;
Comments are good. Use them to explain your code. Comments should have a space between the last&lt;br /&gt;
slash and the start of text.  Inline comments should have at least two spaces between end of code&lt;br /&gt;
and start of the comment. Comments before functions are used for documentation. Always use full &lt;br /&gt;
sentences and end them with a punctuation mark.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * This function changes the world.&lt;br /&gt;
 * @param skynet If `true`, the world ends, otherwise nothing happens.&lt;br /&gt;
 */&lt;br /&gt;
double change_the_world(bool skynet) {&lt;br /&gt;
    if (skynet) {&lt;br /&gt;
        return 0.0;  // Brace for the end of the world.&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use doxygen comments to generate [http://e6.ijs.si/medusa/docs/html/ documentation].&lt;br /&gt;
&lt;br /&gt;
=Headers =&lt;br /&gt;
&lt;br /&gt;
All headers must contain a header guard of form &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;PATH_TO_FILENAME_HPP_&amp;lt;/syntaxhighlight&amp;gt; as enforced by the linter.&lt;br /&gt;
&lt;br /&gt;
Includes in header guards are separated in two groups, with intra-project includes on top and other includes on the bottom.&lt;br /&gt;
The groups are separated by a blank line and includes are kept sorted within a group.&lt;br /&gt;
&lt;br /&gt;
=Misc=&lt;br /&gt;
&lt;br /&gt;
Avoid trailing whitespace. Curly opening brackets &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; { &amp;lt;/syntaxhighlight&amp;gt; should be inline with &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; for &amp;lt;/syntaxhighlight&amp;gt; loops, function&lt;br /&gt;
definitions, class names, separated with a space. Outermost binary operators should have spaces&lt;br /&gt;
around them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
int sumMe(int var) {  // yes&lt;br /&gt;
    if (var == 1)&lt;br /&gt;
    {                 // no&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
For null pointer we use  &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; nullptr &amp;lt;/syntaxhighlight&amp;gt; instead of  &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; NULL &amp;lt;/syntaxhighlight&amp;gt; macro.&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Coding_style&amp;diff=3145</id>
		<title>Coding style</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Coding_style&amp;diff=3145"/>
				<updated>2020-11-18T13:33:47Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a brief description of our coding style, roughtly following the [https://google.github.io/styleguide/cppguide.html Google C++ Style Guide]. &lt;br /&gt;
&lt;br /&gt;
You can also download the CLion settings: [[File:Settings.jar|thumb]], which you can import in &amp;lt;code&amp;gt;File/Import settings&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also download only our code style settings to import in CLion: [[:File:mm.xml]]. It can be imported under &amp;lt;code&amp;gt;Settings/Editor/Code Style/Scheme/Import scheme&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=General=&lt;br /&gt;
We use a 100 characters line width limit in C++ code.&lt;br /&gt;
&lt;br /&gt;
=Indentation=&lt;br /&gt;
&lt;br /&gt;
Indent using spaces. Indentation width is 4 spaces.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
for (int i = 0; i &amp;lt; 10; i++) {&lt;br /&gt;
    cout &amp;lt;&amp;lt; i &amp;lt;&amp;lt; endl;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Naming convention=&lt;br /&gt;
&lt;br /&gt;
Constants - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; UPPER_CASE &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
classes   - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;PascalCase&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
methods - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;camelCase&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
variables and stand-alone functions - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; underscore_separated &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
typedefs - lowercase underscore separated, usually one word with trailing &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; _t &amp;lt;/syntaxhighlight&amp;gt;, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; vec_t &amp;lt;/syntaxhighlight&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
namespaces - one lowercase word, maybe shortened, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; op &amp;lt;/syntaxhighlight&amp;gt;. For internal implementation details use &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; op_internal &amp;lt;/syntaxhighlight&amp;gt;. Namespace closing brace should contain comment  `// namespace your_name`. There is no indentation within namespaces.&lt;br /&gt;
&lt;br /&gt;
All standard abbreviations like [[Weighted Least Squares (WLS)]] or [https://en.wikipedia.org/wiki/Finite_element_method Finite Elements Method (FEM)] -&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;UPPER_CASE&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Floating point and integer literals use small suffixes, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; 0.0f, -1e8l, 45ull&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
#define MAX_VALUE 500&lt;br /&gt;
class MyClass {&lt;br /&gt;
  public:&lt;br /&gt;
    MyClass(first_var, second_var) {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
    int getSize();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Comments=&lt;br /&gt;
&lt;br /&gt;
Comments are good. Use them to explain your code. Comments should have a space between the last&lt;br /&gt;
slash and the start of text.  Inline comments should have at least two spaces between end of code&lt;br /&gt;
and start of the comment. Comments before functions are used for documentation. Always use full &lt;br /&gt;
sentences and end them with a punctuation mark.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * This function changes the world.&lt;br /&gt;
 * @param skynet If `true`, the world ends, otherwise nothing happens.&lt;br /&gt;
 */&lt;br /&gt;
double change_the_world(bool skynet) {&lt;br /&gt;
    if (skynet) {&lt;br /&gt;
        return 0.0;  // Brace for the end of the world.&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use doxygen comments to generate [documentation | http://e6.ijs.si/medusa/docs/html/].&lt;br /&gt;
&lt;br /&gt;
=Headers =&lt;br /&gt;
&lt;br /&gt;
All headers must contain a header guard of form &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;PATH_TO_FILENAME_HPP_&amp;lt;/syntaxhighlight&amp;gt; as enforced by the linter.&lt;br /&gt;
&lt;br /&gt;
Includes in header guards are separated in two groups, with intra-project includes on top and other includes on the bottom.&lt;br /&gt;
The groups are separated by a blank line and includes are kept sorted within a group.&lt;br /&gt;
&lt;br /&gt;
=Misc=&lt;br /&gt;
&lt;br /&gt;
Avoid trailing whitespace. Curly opening brackets &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; { &amp;lt;/syntaxhighlight&amp;gt; should be inline with &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; for &amp;lt;/syntaxhighlight&amp;gt; loops, function&lt;br /&gt;
definitions, class names, separated with a space. Outermost binary operators should have spaces&lt;br /&gt;
around them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
int sumMe(int var) {  // yes&lt;br /&gt;
    if (var == 1)&lt;br /&gt;
    {                 // no&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
For null pointer we use  &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; nullptr &amp;lt;/syntaxhighlight&amp;gt; instead of  &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; NULL &amp;lt;/syntaxhighlight&amp;gt; macro.&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3144</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3144"/>
				<updated>2020-11-16T10:22:01Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors can be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure. Note that the polyhedron, represented in the OFF file is considered to be the exact domain, which is then discretize with meshless techniques. The mesh is used only to define the domain, and is considered fixed and final. Discretizations can (and usually should) be smaller than.&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the bunny OFF model with surface nodes of various types, as defined by the face colors, along with the surface normals.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-surface.png|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-sol.png|400px]]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3143</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3143"/>
				<updated>2020-11-16T10:06:30Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors can be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored2.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure. Note that the polyhedron, represented in the OFF file is considered to be the exact domain, which is then discretize with meshless techniques. The mesh is used only to define the domain, and is considered fixed and final. Discretizations can (and usually should) be smaller than.&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the bunny OFF model with surface nodes of various types, as defined by the face colors, along with the surface normals.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-surface.png|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-sol.png|400px]]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny-colored2.png&amp;diff=3142</id>
		<title>File:Bunny-colored2.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny-colored2.png&amp;diff=3142"/>
				<updated>2020-11-16T10:06:19Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3141</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3141"/>
				<updated>2020-11-12T18:43:06Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Working with 3D models in Medusa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors can be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure. Note that the polyhedron, represented in the OFF file is considered to be the exact domain, which is then discretize with meshless techniques. The mesh is used only to define the domain, and is considered fixed and final. Discretizations can (and usually should) be smaller than.&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the bunny OFF model with surface nodes of various types, as defined by the face colors, along with the surface normals.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-surface.png|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-sol.png|400px]]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny-sol.png&amp;diff=3140</id>
		<title>File:Bunny-sol.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny-sol.png&amp;diff=3140"/>
				<updated>2020-11-12T18:42:56Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3139</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3139"/>
				<updated>2020-11-12T17:12:04Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors can be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure. Note that the polyhedron, represented in the OFF file is considered to be the exact domain, which is then discretize with meshless techniques. The mesh is used only to define the domain, and is considered fixed and final. Discretizations can (and usually should) be smaller than.&lt;br /&gt;
&lt;br /&gt;
Below is a picture of the bunny OFF model with surface nodes of various types, as defined by the face colors, along with the surface normals.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-surface.png|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny-surface.png&amp;diff=3138</id>
		<title>File:Bunny-surface.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny-surface.png&amp;diff=3138"/>
				<updated>2020-11-12T17:11:50Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3137</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3137"/>
				<updated>2020-11-12T16:47:24Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Formats, software, and other resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors can be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3136</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3136"/>
				<updated>2020-11-12T13:24:46Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Working with 3D models in Medusa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors ban be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] that was colored as the picture above. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3135</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3135"/>
				<updated>2020-11-12T13:24:10Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Formats, software, and other resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces. See the Filters / Remeshing or the Filters / Color menu. Meshlab also colors vertices, and when saving, one can choose to save only the face colors. Saving also the vetor files with cause the file to be saved as COFF format, which also supports vertex colors. &lt;br /&gt;
&lt;br /&gt;
Below is an example of colored bunny. The colors ban be used to identify surface regions where different boundary conditions should be applied.&lt;br /&gt;
&lt;br /&gt;
[[File:bunny-colored.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny-colored.png&amp;diff=3134</id>
		<title>File:Bunny-colored.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny-colored.png&amp;diff=3134"/>
				<updated>2020-11-12T13:23:57Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3133</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3133"/>
				<updated>2020-11-12T11:22:53Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Working with 3D models in Medusa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces.&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required methods. Notably, CGAL is use to get a proper implementation of &amp;lt;code&amp;gt;contains&amp;lt;/code&amp;gt; method, that is needed for filling the domain. CGAL is also used to get the bounding box, and to store the surface mesh in an easily traversable data structure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3132</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3132"/>
				<updated>2020-11-12T11:01:41Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
&lt;br /&gt;
[[File:bunny_meshlab.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces.&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required models.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3131</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3131"/>
				<updated>2020-11-12T11:01:24Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with surface meshes: [https://doc.cgal.org/latest/Surface_mesh/index.html https://doc.cgal.org/latest/Surface_mesh/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight) and triangular. Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems. OFF files include an option to specify the color of each face, which can be used to identify different surface regions.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;surface mesh&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
This shows the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file referenced above open in Meshlab. &lt;br /&gt;
[[File:bunny_meshlab.png|662px]]&lt;br /&gt;
&lt;br /&gt;
Meshlab can also be used to fill holes, clean meshes and color faces.&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required models.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny_meshlab.png&amp;diff=3130</id>
		<title>File:Bunny meshlab.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Bunny_meshlab.png&amp;diff=3130"/>
				<updated>2020-11-12T10:31:09Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3129</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3129"/>
				<updated>2020-11-10T11:01:17Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Formats, software, and other resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering). Usually it is simplest to inspect them with Meshlab and also use it to save files as OFF.&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required models.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3128</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3128"/>
				<updated>2020-11-09T15:13:24Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Working with 3D models in Medusa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering).&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
This is done by inheriting from &amp;lt;code&amp;gt;DomainShape&amp;lt;/code&amp;gt; and defining the required models.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3127</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3127"/>
				<updated>2020-11-09T15:12:45Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Working with 3D models in Medusa */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering).&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3126</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3126"/>
				<updated>2020-11-09T15:11:56Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering).&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;snytaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main() {&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/snytaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3125</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3125"/>
				<updated>2020-11-09T15:11:27Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering).&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;br /&gt;
&lt;br /&gt;
We assume that an OFF file has been successfully obtained, in this example we will use the &amp;lt;code&amp;gt;bunny.off&amp;lt;/code&amp;gt; file from [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]. To work with Medusa, we can make a generic &amp;lt;code&amp;gt;PolyhedronShape&amp;lt;/code&amp;gt;, that can also be used with other existing shapes (translations, boolean operations, etc).&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3124</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3124"/>
				<updated>2020-11-09T15:08:27Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries.&lt;br /&gt;
&lt;br /&gt;
== Formats, software, and other resources ==&lt;br /&gt;
&lt;br /&gt;
A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering).&lt;br /&gt;
&lt;br /&gt;
== Working with 3D models in Medusa ==&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3123</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3123"/>
				<updated>2020-11-09T15:07:29Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Formats and software ==&lt;br /&gt;
&lt;br /&gt;
Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering).&lt;br /&gt;
&lt;br /&gt;
## Working in Medusa&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3122</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3122"/>
				<updated>2020-11-09T15:07:23Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Formats and software&lt;br /&gt;
&lt;br /&gt;
Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering).&lt;br /&gt;
&lt;br /&gt;
## Working in Medusa&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3121</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3121"/>
				<updated>2020-11-09T15:07:12Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;## Formats and software&lt;br /&gt;
&lt;br /&gt;
Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off] Googling with keywords &amp;quot;polyhedron&amp;quot;, &amp;quot;watertight&amp;quot;, &amp;quot;closed&amp;quot;, &amp;quot;OFF&amp;quot; or &amp;quot;PLY&amp;quot; might help.&lt;br /&gt;
General models (often STL files) can be downloaded from [https://grabcad.com/ https://grabcad.com/] (after registering).&lt;br /&gt;
&lt;br /&gt;
## Working in Medusa&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3120</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3120"/>
				<updated>2020-11-09T14:54:52Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Function/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3119</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3119"/>
				<updated>2020-11-09T14:54:23Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Funciton/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models]. Specifically, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3118</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3118"/>
				<updated>2020-11-09T14:54:03Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Funciton/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Obtaining models can be somewhat difficult, as this files are often used to store general 3D objects for rendering. Here is a list of common 3D models (not all of which are polyhedrons): [https://github.com/alecjacobson/common-3d-test-models https://github.com/alecjacobson/common-3d-test-models].&lt;br /&gt;
&lt;br /&gt;
Specificaly, an altered Stanford bunny model (made watertight) in OFF format can be found here [https://github.com/OpenGP/OpenGP/blob/master/data/bunny.off]&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3117</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3117"/>
				<updated>2020-11-09T14:50:28Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files [https://en.wikipedia.org/wiki/OFF_(file_format)], and these files can also be easily viewd by &amp;lt;code&amp;gt;geomview&amp;lt;/code&amp;gt; [http://www.geomview.org/], also trivially installable on most Linux systems.&lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ, and other proprietary formats. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. Similar hold for OBJ files, although, these files can contain many other types of objects besides polygon meshes. CGAL includes readers and writers for OFF, PLY, OBJ and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file. Further demos for polyhedron IO are available in the CGAL repo [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO].&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Funciton/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3116</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3116"/>
				<updated>2020-11-09T14:41:39Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
CGAL can usually be installed with &amp;lt;code&amp;gt;apt-get install libcgal-dev&amp;lt;/code&amp;gt; or similar. The Qt dependency is not necessary, but can be useful for easier visualization without exporting to an external program.&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads OFF files. [https://en.wikipedia.org/wiki/OFF_(file_format)] &lt;br /&gt;
&lt;br /&gt;
Other formats include STL, PLY and OBJ. Some of these formats are more appropriate than others. Notably STL, while very common, can be problematic, as it does not include connections between faces, bit only a list of triangles, from which the polyhedron must first be reconstructed. This can be done directly in CGAL by using &amp;lt;code&amp;gt;CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh&amp;lt;/code&amp;gt;, through an intermediate program, like Meshlab https://www.meshlab.net/, or through an online converter, such as https://cadcook.com/ply-off/. Note that it is not necessary that any of these conversions work, since STL file can represent an object with holes in the surface mesh or other degenerated objects.&lt;br /&gt;
PLY files on the other hand do represent surface meshes, and can be read in CGAL (or easily converted to OFF) [https://cadcook.com/ply-off]. CGAL includes readers and writers for OFF, PLY and STL formats [https://github.com/CGAL/cgal/tree/master/Polyhedron_IO/include/CGAL/IO], and the default &amp;lt;code&amp;gt;cin &amp;gt;&amp;gt; &amp;lt;/code&amp;gt; operator expects an OFF file.&lt;br /&gt;
&lt;br /&gt;
PLY, OFF and STL files can also be read with Matlab, but require (short) external functions, available at [https://www.mathworks.com/matlabcentral/fileexchange/46540-geometry-processing-package], see Funciton/IO. These return a list of vertices and faces, that can be plotted with &amp;lt;code&amp;gt;patch&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;trisurf&amp;lt;/code&amp;gt; after constructing the triangulation.&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3115</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3115"/>
				<updated>2020-11-09T14:17:20Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads .off [https://en.wikipedia.org/wiki/OFF_(file_format)] files.&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3114</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3114"/>
				<updated>2020-11-09T14:17:05Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads .off [https://en.wikipedia.org/wiki/OFF_(file_format)] files.&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3113</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3113"/>
				<updated>2020-11-09T14:16:26Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces. By default, CGAL reads `.off`&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3112</id>
		<title>Realistic 3D models</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Realistic_3D_models&amp;diff=3112"/>
				<updated>2020-11-09T14:13:55Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: Created page with &amp;quot;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be desc...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Medusa is not meant to deal with complex 3D geometry - we support balls, cuboids, and their differences, unions, translations and rotations. More general 2D shapes can be described by polygons, which are also included in Medusa. For more general 3D objects, the geometric algorithms become more complex and it makes sense to leverage third-party libraries. A good library in c++ is CGAL ([https://www.cgal.org/]), that we can use to work with polyhedrons: [https://doc.cgal.org/latest/Polyhedron/index.html]&lt;br /&gt;
&lt;br /&gt;
Polyhedrons are solid bodies with polygonal faces, and their surface forms a closed mesh. CGAL can work also with surfaces meshes that are not closed, but for PDE solving in 3D bodies, we assume them to be closed (or watertight). Polyhedron data is usually stored in a separate file with many different formats available. Some of the formats actually store the polyhedron data (including how faces are connected) and some only store the faces.&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Medusa&amp;diff=3111</id>
		<title>Medusa</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Medusa&amp;diff=3111"/>
				<updated>2020-11-09T13:51:25Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Building blocks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--__NOTITLE__--&amp;gt;&lt;br /&gt;
'''Welcome to the Medusa wiki. To visit the main website, go to [http://e6.ijs.si/medusa/ http://e6.ijs.si/medusa/].'''&lt;br /&gt;
&lt;br /&gt;
In [http://e6.ijs.si/ParallelAndDistributedSystems/ Parallel and Distributed Systems Laboratory] we are working on a C++ library that is first and foremost focused on tools for solving Partial Differential Equations by meshless methods. The basic idea is to create generic codes for tools that are needed for solving not only PDEs but many other problems, e.g. Moving Least Squares approximation, $k$-d tree, domain generation engines, etc.&lt;br /&gt;
We call this open source meshless project [http://e6.ijs.si/medusa/ Medusa: Coordinate Free Meshless Method implementation (MM)].&lt;br /&gt;
&lt;br /&gt;
Technical details about code and examples  can be found on our [http://e6.ijs.si/medusa/docs/ documentation page] and [https://gitlab.com/e62Lab/medusa Gitlab repository]. [[File:C.png|100px||link=https://gitlab.com/e62Lab/medusa|alt=Alt text|code]] [[File:doxygen.png|100px|link=http://e6.ijs.si/medusa/docs/|alt=Alt text|Documentation page]]&lt;br /&gt;
&lt;br /&gt;
This wiki site is meant for more relaxed discussions about general principles, possible and already implemented applications, preliminary analyses, etc.&lt;br /&gt;
Note, that there are many grammatical mistakes, typos, stupid sentences, etc. This wiki is meant for quick information exchange and therefore we do not invest a lot of energy into styling :).  &lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [https://gitlab.com/e62Lab/medusa Code on Gitlab]&lt;br /&gt;
* [[How to build | Installation and building]]&lt;br /&gt;
* [[Including this library in your project | Including this library in your project]]&lt;br /&gt;
* [[Testing | Running tests]]&lt;br /&gt;
* [http://e6.ijs.si/medusa/docs/ Technical documentation]&lt;br /&gt;
* [[Coding style | Coding style]]&lt;br /&gt;
* [[Wiki editing guide | Wiki editing and backup guide]]&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
In this section we present exact examples. Each of the below solutions can be found also in in the repository under examples. More explanation about the physical background and solution procedure can be found in following sections.&lt;br /&gt;
* [[Philosophy of examples and how to run them]]&lt;br /&gt;
* [[Poisson's equation]]&lt;br /&gt;
* [[Heat equation]]&lt;br /&gt;
* [[Linear elasticity]]&lt;br /&gt;
* [[Complex-valued problems]]&lt;br /&gt;
* [[Coupled domains]]&lt;br /&gt;
* [[Parametric domains | Parametric domains &amp;amp;ndash; Curved surface with variable density]]&lt;br /&gt;
* [[NURBS domains | Domains modeled with non-uniform rational basis spline's (NURBS)]]&lt;br /&gt;
* [[Customization]]&lt;br /&gt;
* [[Ghost nodes]]&lt;br /&gt;
* [[Electromagnetic scattering]]&lt;br /&gt;
* [[Schrödinger equation]]&lt;br /&gt;
* [[Wave equation]]&lt;br /&gt;
* [[Cahn-Hilliard equation]]&lt;br /&gt;
* [[Non-Newtonian_fluid_example | Non-Newtonian fluid]]&lt;br /&gt;
* [[Meshless Lattice Boltzmann method]]&lt;br /&gt;
&lt;br /&gt;
== Building blocks ==&lt;br /&gt;
Medusa is modular coordinate-free parallel implementation of a numerical framework designed, but not limited to, for solving PDEs. In this section we present main modules of the library that can be also used as a standalone tools. &lt;br /&gt;
* [[Positioning of computational nodes]] &lt;br /&gt;
* [[Relaxation of the nodal distribution]]&lt;br /&gt;
* [[Refinement of the nodal distribution]]&lt;br /&gt;
* [[k-d tree|''k''-d tree]] and other spatial search structures&lt;br /&gt;
* Solving [[Solving linear systems | linear systems]], [[Solving overdetermined systems | overdetermined]] and [[Solving underdetermined systems | underdetermined]]&lt;br /&gt;
* [[Weighted Least Squares (WLS)]]&lt;br /&gt;
* [[Computation of shape functions]]&lt;br /&gt;
* [[Meshless Local Strong Form Method (MLSM)]]&lt;br /&gt;
* [[Radial basis function-generated finite differences (RBF-FD)]]&lt;br /&gt;
* [[Ghost nodes (theory)]]&lt;br /&gt;
* [[Integrators for time stepping]]&lt;br /&gt;
* [[RBF Interpolation]]&lt;br /&gt;
* [[Complex 3D models]]&lt;br /&gt;
&lt;br /&gt;
== Discussions / Applications ==&lt;br /&gt;
This section is meant for general discussion about the physical background of the examples, the solution procedures, various applications, etc. Note, that code snippets presented in discussion might not reflect the actual state of Medusa.  &lt;br /&gt;
* Basic PDE solutions&lt;br /&gt;
** [[Convection Diffusion equation | Convection Diffusion equation]]&lt;br /&gt;
**[[Wave equation application]] &lt;br /&gt;
* [[Adaptivity]]&lt;br /&gt;
* [[Solid Mechanics]]&lt;br /&gt;
** [[Point contact]]&lt;br /&gt;
** [[Hertzian contact]]&lt;br /&gt;
** [[Cantilever beam]]&lt;br /&gt;
** [[Fretting fatigue case]]&lt;br /&gt;
* [[Fluid Mechanics]]&lt;br /&gt;
** [[Lid driven cavity]]&lt;br /&gt;
** [[de Vahl Davis natural convection test]]&lt;br /&gt;
** [[Natural convection in 3D irregular domain]]&lt;br /&gt;
** [[Natural convection from heated cylinder]]&lt;br /&gt;
** [[Natural convection between concentric cylinders]]&lt;br /&gt;
** [[Non-Newtonian fluid]]&lt;br /&gt;
* [[Computational electromagnetics]]&lt;br /&gt;
** [[Triple dielectric step in 1D]]&lt;br /&gt;
** [[Scattering from an infinite cylinder]]&lt;br /&gt;
** [[Point source near an anisotropic lens]]&lt;br /&gt;
* Other applications&lt;br /&gt;
** [[Attenuation due to liquid water content in the atmosphere|Attenuation of a satellite communication]]&lt;br /&gt;
** [[Heart rate variability detection]]&lt;br /&gt;
** [[Bioheat equation]]&lt;br /&gt;
&lt;br /&gt;
== Performance analyses ==&lt;br /&gt;
* [[Execution on Intel® Xeon Phi™ co-processor]]&lt;br /&gt;
* [[1D MLSM and FDM comparison]]&lt;br /&gt;
* [[:File:tech_report.pdf|Execution overheads due to clumsy types::technical report]] [[File:pdf-file.gif]]&lt;br /&gt;
* [[Solving sparse systems]]&lt;br /&gt;
* [[Eigen paralelization]]&lt;br /&gt;
&lt;br /&gt;
== Last changes ==&lt;br /&gt;
&amp;lt;news unique=1 limit = 5&amp;gt;&lt;br /&gt;
*{{{timeanddate}}} :: {{{title}}} &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/news&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
* FAQ  - [[Frequently asked questions]]. &lt;br /&gt;
* [[List of wiki contributors]]&lt;br /&gt;
* List of library contributors: [http://e6.ijs.si/medusa/about#about-contributors See the official website]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* Slak J., Kosec G. Adaptive radial basis function-generated finite differences method for contact problems. International journal for numerical methods in engineering, ISSN 0029-5981 [http://www-e6.ijs.si/ParallelAndDistributedSystems/pdf/32230439.pdf manuscript]&lt;br /&gt;
* Slak J., Kosec G.; Refined meshless local strong form solution of Cauchy-Navier equation on an irregular domain. Engineering analysis with boundary elements. 2018;11 ; [http://comms.ijs.si/~gkosec/data/papers/31107623.pdf manuscript]&lt;br /&gt;
* Depolli, M., Kosec, G., Assessment of differential evolution for multi-objective optimization in a natural convection problem solved by a local meshless method. Engineering optimization, 2017, vol. 49, no. 4, pp. 675-692 ;[http://comms.ijs.si/~gkosec/data/papers/29639719.pdf manuscript]&lt;br /&gt;
* Kosec G., A local numerical solution of a fluid-flow problem on an irregular domain. Advances in engineering software. 2016;7 ; [29512743] ; [http://comms.ijs.si/~gkosec/data/papers/29512743.pdf manuscript]&lt;br /&gt;
* Kosec G., Trobec R., Simulation of semiconductor devices with a local numerical approach. Engineering analysis with boundary elements. 2015;69-75; [27912487] ; [http://comms.ijs.si/~gkosec/data/papers/27912487.pdf manuscript]&lt;br /&gt;
* Kosec G., Šarler B., Simulation of macrosegregation with mesosegregates in binary metallic casts by a meshless method. Engineering analysis with boundary elements. 2014;36-44; [http://comms.ijs.si/~gkosec/data/papers/3218939.pdf manuscript]&lt;br /&gt;
* Kosec G., Depolli M., Rashkovska A., Trobec R., Super linear speedup in a local parallel meshless solution of thermo-fluid problem. Computers &amp;amp; Structures. 2014;133:30-38; [http://comms.ijs.si/~gkosec/data/papers/27339815.pdf manuscript]&lt;br /&gt;
* Kosec G., Zinterhof P., Local strong form meshless method on multiple Graphics Processing Units. Computer modeling in engineering &amp;amp; sciences. 2013;91:377-396; [http://comms.ijs.si/~gkosec/data/papers/26785063.pdf manuscript]&lt;br /&gt;
* Kosec G., Šarler B., H-adaptive local radial basis function collocation meshless method. Computers, materials &amp;amp; continua. 2011;26:227-253; [http://comms.ijs.si/~gkosec/data/papers/KosecSarlerBurgers.pdf manuscript]&lt;br /&gt;
* Trobec R., Kosec G., Šterk M., Šarler B., Comparison of local weak and strong form meshless methods for 2-D diffusion equation. Engineering analysis with boundary elements. 2012;36:310-321; [http://comms.ijs.si/~gkosec/data/papers/EABE2499.pdf manuscript]&lt;br /&gt;
* Kosec G, Zaloznik M, Sarler B, Combeau H. A Meshless Approach Towards Solution of Macrosegregation Phenomena. CMC: Computers, Materials, &amp;amp; Continua. 2011;580:1-27 [http://comms.ijs.si/~gkosec/data/papers/KosecZaloznikSarlerCombeauSegregation.pdf manuscript]&lt;br /&gt;
* Kosec G, Sarler B. Solution of thermo-fluid problems by collocation with local pressure correction. International Journal of Numerical Methods for Heat &amp;amp; Fluid Flow. 2008;18:868-82 [http://comms.ijs.si/~gkosec/data/papers/KosecSarlerNS2008.pdf manuscript]&lt;br /&gt;
*  Trobec R., Kosec G., Parallel Scientific Computing, ISBN: 978-3-319-17072-5 (Print) 978-3-319-17073-2.&lt;br /&gt;
*  Slak, J., Kosec, G.. Detection of heart rate variability from a wearable differential ECG device., MIPRO 2016, 39th International Convention, 2016, Opatija, Croatia, ISSN 1847-3938, pp 450-455.&lt;br /&gt;
*  Kolman, M., Kosec, G. Correlation between attenuation of 20 GHz satellite communication link and liquid water content in the atmosphere. MIPRO 2016, 39th International Convention, 2016, Opatija, Croatia, ISSN 1847-3938. pp. 308-313.&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
* http://e6.ijs.si/ParallelAndDistributedSystems/#!NumericalMethods&lt;br /&gt;
* http://e6.ijs.si/ParallelAndDistributedSystems/#!utils&lt;br /&gt;
* http://e6.ijs.si/ParallelAndDistributedSystems/#!NUMA&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Computation_of_shape_functions&amp;diff=3037</id>
		<title>Computation of shape functions</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Computation_of_shape_functions&amp;diff=3037"/>
				<updated>2020-08-29T09:26:34Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Another view on derivation of shape functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Shape functions, often called stencil weights, are functionals, approximating linear partial differential operators at a chosen point. &lt;br /&gt;
A shape function $\b{\chi}_{\mathcal{L}} (\vec{p})$ for a linear parial differential operator $\mathcal{L}$&lt;br /&gt;
in a point $p$ is a vector of stencil weights, such that&lt;br /&gt;
\[&lt;br /&gt;
(\mathcal{L} u)(\vec{p}) \approx \b{\chi}_{\mathcal{L}}(\vec{p})^\T \b{u},&lt;br /&gt;
\]&lt;br /&gt;
where $\b{u}$ is a vector of function values $u(x_i)$ evaluated in the support of $\vec{p}$.&lt;br /&gt;
For usage examples see the section on [[Meshless Local Strong Form Method (MLSM)]] or some [[ Poisson's equation | examples ]].&lt;br /&gt;
&lt;br /&gt;
For computation of shape functions augmented with monomials, see the [[ Radial basis function-generated finite differences (RBF-FD) ]].&lt;br /&gt;
&lt;br /&gt;
== Derivation ==&lt;br /&gt;
Let $\mathcal{L}$ be a linear partial differential operator.&lt;br /&gt;
We wish to approximate $(\mathcal{L}u)(\vec{p})$ using only values of $u$ in support of $p$. To do so, we construct a &lt;br /&gt;
WLS approximation (see [[Weighted Least Squares (WLS)]]) and compute the coefficients $\b{\alpha}$, such that $\hat{u}(\vec{p}) = \b{b}(\vec{p})^\T \b{\alpha}$.&lt;br /&gt;
The coefficients are computed by solving a least-squares system $WB \b{\alpha} = W\b{u}$, (see [[Solving overdetermined systems]])&lt;br /&gt;
writing&lt;br /&gt;
\[ \b{\alpha} = (B^\T W^2 B^\T)^{-1} B^\T W^2 \b{u}. \]&lt;br /&gt;
Writing down the approximation function $\hat{u}$ we get&lt;br /&gt;
\[&lt;br /&gt;
\hat u (\vec{p}) = \b{b}(\vec{p})^\T \b{\alpha} = \b{b}(\vec{p})^\T (WB)^+W\b{u} &lt;br /&gt;
\]&lt;br /&gt;
and applying operator $\mathcal{L}$ we get &lt;br /&gt;
\[&lt;br /&gt;
    \hat u (\vec{p}) = (\mathcal{L}\b{b})(\vec{p})^\T \b{\alpha} = &lt;br /&gt;
(\mathcal{L}\b{b})(\vec{p})^\T (B^\T W^2 B)^{-1} B^\T W^2 \b{u} &lt;br /&gt;
= \b{\chi}_{\mathcal{L}}(\vec{p})^\T \b{u}&lt;br /&gt;
\]&lt;br /&gt;
&lt;br /&gt;
Depending on what data we have available, we can either compute $\b \alpha$ and obtain a continuous approximation $\hat{u}$,&lt;br /&gt;
to which $\mathcal{L}$ can be applied at any point, or, if function values $\b u$ are unknown, we can choose to compute&lt;br /&gt;
$\b \chi_{\mathcal{L}}$ at a point $\vec p$ and approximate the operator for ''any'' set of function values. &lt;br /&gt;
the operator $\mathcal{L}$ at $\vec p$ is approximated as &lt;br /&gt;
\[&lt;br /&gt;
  (\mathcal{L}u)(\vec{p}) \approx (\mathcal{L} \hat{u})(p) = \b{\chi}_{\mathcal{L}}(\vec{p})^\T \b{u}.&lt;br /&gt;
\]&lt;br /&gt;
Vector $\b{\chi}$ is a vector of stencil weights, also called a ''shape function''. The name comes historically from FEM, and it incorporates the idea of being able to take all the information&lt;br /&gt;
about shape of the local domain and choice of approximation and store it in a single vector, being able to approximate&lt;br /&gt;
a function value from given support values $\b{u}$ with a single dot product. For any values $\b{u}$, value $\b{\chi}(p) \b{u}$&lt;br /&gt;
gives us the approximation of $(\mathcal{L}u)(\vec{p})$.&lt;br /&gt;
Mathematically speaking, $\b{\chi}(\vec{p})$ is a Riesz representation of a functional, $\b{\chi}(\vec{p})\colon \R^n \to \R$, mapping $n$-tuples of known function values to&lt;br /&gt;
approximations of $\mathcal{L}$ in point $\vec{p}$.&lt;br /&gt;
&lt;br /&gt;
For example, take a $1$-dimensional case for approximation of derivatives with weight equal to $1$ and $n=m=3$, with equally spaced support values at distances $h$.&lt;br /&gt;
We wish to approximate $u''$ in the middle support point, just by making a weighted sum of the values, something like the finite difference&lt;br /&gt;
\[ u'' \approx \frac{u_1 - 2u_2 + u_3}{h^2}. \]&lt;br /&gt;
This is exactly the same formula as we would have come to by computing $\b{\chi}$, except that our approach is a lot more general. But one should think about&lt;br /&gt;
$\b{\chi}$ as one would about the finite difference scheme, it is a rule, telling us how to compute the derivative.&lt;br /&gt;
\[ u''(s_2) \approx \underbrace{\begin{bmatrix} \frac{1}{h^2} &amp;amp; \frac{-2}{h^2} &amp;amp; \frac{1}{h^2} \end{bmatrix}}_{\b{\chi}^\T} \begin{bmatrix}u_1 \\ u_2 \\ u_3 \end{bmatrix}  \]&lt;br /&gt;
&lt;br /&gt;
The fact that $\b{\chi}$ is independent of the function values $\b{u}$ but depend only on domain geometry means that&lt;br /&gt;
'''we can just compute the shape functions $\b{\chi}$ for points of interest and then approximate any linear operator&lt;br /&gt;
of any function, given its values, very fast, using only a single dot product.'''&lt;br /&gt;
&lt;br /&gt;
== Special case when $B$ is square and invertible ==&lt;br /&gt;
The expression&lt;br /&gt;
\[ \b{\chi}_{\mathcal{L}}(\vec{p})^\T = (\mathcal{L}\b{b})(\vec{p})^\T (B^\T W^2 B)^{-1} B^\T W^2 \]&lt;br /&gt;
can be simplified to &lt;br /&gt;
\[&lt;br /&gt;
  \b \chi_{\mathcal{L}}(\vec{p})^\T = (\mathcal{L}\b{b})(\vec{p})^\T B^{-1}.&lt;br /&gt;
\]&lt;br /&gt;
&lt;br /&gt;
This gives the approximation as $(\mathcal{L} \hat{u})(p) = (\mathcal{L}\b{b})(\vec{p})^\T B^{-1} \b u$. &lt;br /&gt;
&lt;br /&gt;
Coefficients $\b \alpha$ are the solutions of $B\b \alpha = \b u$. Shape function $\b{\chi}_{\mathcal{L}}(\vec{p})$ is defined as&lt;br /&gt;
$$ &lt;br /&gt;
\b{\chi}_{\mathcal{L}}(\vec{p})^\T = (\mathcal{L}\b{b})(\vec{p})^\T B^{-1},&lt;br /&gt;
$$&lt;br /&gt;
which can be rewritten as a solution of &lt;br /&gt;
$$ B^\T \b{\chi}_{\mathcal{L}}(\vec{p}) =  (\mathcal{L}\b{b})(\vec{p}). $$&lt;br /&gt;
&lt;br /&gt;
This formulation is more suitable for numerical solving and also has a deeper interpretation, as presented in the next section.&lt;br /&gt;
&lt;br /&gt;
== Another view on derivation of shape functions ==&lt;br /&gt;
Solving the system $B^\T \b{\chi}_{\mathcal{L}} (\vec{p})^\T = (\mathcal{L}\b{b})(\vec p)$ can be interpreted as using the method of undetermined coefficients.&lt;br /&gt;
&lt;br /&gt;
We wish to find such a combination of function values evaluated in support points $\vec s_i$ that approximates the value of an operator $(\mathcal{L}u)(\vec p)$, i.e., we are looking for coefficients $\chi_{\mathcal{L}, i}$, such that&lt;br /&gt;
\[ \sum_{i=1}^n \chi_{\mathcal{L}, i} u_i \approx (\mathcal{L}u)(p). \]&lt;br /&gt;
&lt;br /&gt;
We require that $\chi_{\mathcal{L}, i}$ be such, that above approximations holds for a certain space of functions, spanned by the basis $\{b_j\}_{j=1}^m$.&lt;br /&gt;
By choosing the basis functions $b_j$ we decide for which functions the aproximation $\b{\chi}_{\mathcal{L}, \vec{p}} \b{u} \approx (\mathcal{L}u)(\vec p)$ should be exact and we write the equations &lt;br /&gt;
$\sum_{i=1}^n \chi_{\mathcal{L}, i} b_j(\vec s_i) = (\mathcal{L}b_j)(\vec p)$ in a system:&lt;br /&gt;
\[&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
  b_1(\vec s_1) &amp;amp; \cdots &amp;amp; b_1(\vec s_n) \\&lt;br /&gt;
  \vdots &amp;amp; \ddots &amp;amp; \vdots \\&lt;br /&gt;
  b_m(\vec s_1) &amp;amp; \cdots &amp;amp; b_m(\vec s_n) \\&lt;br /&gt;
\end{bmatrix}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
 \chi_{\mathcal{L}, 1} \\ \vdots \\ \chi_{\mathcal{L}, n}&lt;br /&gt;
\end{bmatrix}&lt;br /&gt;
=&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
  (\mathcal{L} b_1)(\vec{p}) \\ \vdots \\ (\mathcal{L} b_m)(\vec{p})&lt;br /&gt;
\end{bmatrix}&lt;br /&gt;
\]&lt;br /&gt;
Note that the matrix above is precisely the transpose of the matrix $B$ from the [[Weighted Least Squares (WLS) ]] approximation. In this sense, the computation of &lt;br /&gt;
shape functions is dual to computation of basis coefficients. The system is written in matrix form as $B^\T \b{\chi}_{\mathcal{L}} (\vec{p})^\T = (\mathcal{L}\b{b})(\vec p)$. &lt;br /&gt;
&lt;br /&gt;
For $n=m$ case as in the previous section, the solution is the sought shape function $\b{\chi}_{\mathcal L}$.&lt;br /&gt;
&lt;br /&gt;
If we do not specify enough functions $b_j$, the system above is underdetermined.&lt;br /&gt;
A common solution is to minimize the weighted norm of $\b \chi_{\mathcal L}$.&lt;br /&gt;
This gives us a minimization problem&lt;br /&gt;
$$&lt;br /&gt;
 \min_{\b \chi_{\mathcal L}} \sum_{i=1}^n (\chi_{\mathcal{L}, i}/w_i)^2, \text{ such that } B^\T \b{\chi}_{\mathcal{L}} (\vec{p})^\T = (\mathcal{L}\b{b})(\vec p).&lt;br /&gt;
$$&lt;br /&gt;
If the central weights are bigger, this also forces the central coefficients to be larger.&lt;br /&gt;
&lt;br /&gt;
Using the solution derived in [[Solving underdetermined systems]] and substituting inverse weights $W = W^{-1}$ and matrix $A = B^\T$, we get the solution&lt;br /&gt;
$$&lt;br /&gt;
\b{\chi}_{\mathcal{L}} (\vec{p}) = (W^{-1})^{-2} (B^\T)^\T (B^\T (W^{-1})^{-2}(B^\T)^\T)^{-1} (\mathcal{L}\b{b})(\vec p) = W^2 B (B^\T W^2 B)^{-1} (\mathcal{L}\b{b})(\vec p).&lt;br /&gt;
$$&lt;br /&gt;
After transposing, we get&lt;br /&gt;
$$&lt;br /&gt;
\b{\chi}_{\mathcal{L}} (\vec{p})^\T = (\mathcal{L}\b{b})(\vec p)^\T (B^\T W^2 B)^{-1} B^\T W^2,&lt;br /&gt;
$$&lt;br /&gt;
which is exactly the same formula as derived using [[ Weighted Least Squares (WLS) ]] approximation.&lt;br /&gt;
&lt;br /&gt;
Just as we get the same stencil weights using interpolation and the method of undetermined coefficients, we get the same result using &lt;br /&gt;
WLS approximation or weighted norm minimization of shape functions.&lt;br /&gt;
&lt;br /&gt;
== Numerical calculation of the shape functions ==&lt;br /&gt;
Numerically cheaper and more stable way is to translate the problem of inverting the matrix to solving a linear system of equations.&lt;br /&gt;
The alternative view above is useful in this aspect.&lt;br /&gt;
&lt;br /&gt;
=== Invertible $B$ ===&lt;br /&gt;
&lt;br /&gt;
If $B$ is invertible, then $\b{\chi}_{\mathcal{L}}(\vec{p})$ can be thought as a solution of a system $B^\T\b{\chi}_{\mathcal{L}}(\vec{p}) = (\mathcal{L}\b{b})(\vec p)$, which can be solved using LU or Cholesky decomposition for example.&lt;br /&gt;
For more on this, see [[Solving linear systems]].&lt;br /&gt;
&lt;br /&gt;
=== General case ===&lt;br /&gt;
In general, the system $B^\T\b{\chi}_{\mathcal{L}}(\vec{p}) = (\mathcal{L}\b{b})(\vec p)$ is underdetermined and must be solved in the least-weighted-norm sense.&lt;br /&gt;
This means solving the underdetermined system $B^\T W y =  (\mathcal{L}\b{b})(\vec p)$ and computing $\b{\chi}_{\mathcal{L}}(\vec{p}) = Wy$.&lt;br /&gt;
For more details on this, see [[Solving underdetermined systems]]. &lt;br /&gt;
&lt;br /&gt;
Depending on our knowledge of the &lt;br /&gt;
problem, we can use Cholesky ($B^\T W$ is positive definite), $LDL^\T$ if it is symmetric, $LU$ for a general square matrix, $QR$ for full rank overdetermined system and SVD for a general system.&lt;br /&gt;
&lt;br /&gt;
If more shapes need to be calculated using the same matrix $B^\T W$ and only different right hand sides (as is often the case, if shapes for more than one operator are computed), &lt;br /&gt;
it can be done efficiently by storing the decomposition of $B^\T W$.&lt;br /&gt;
&lt;br /&gt;
== Linearity and reduction to only computing the shapes of the operator space basis ==&lt;br /&gt;
Observe that the expression for the shape functions&lt;br /&gt;
\[ \b{\chi}_{\mathcal{L}}(\vec{p}) = (\mathcal{L}\b{b})(\vec{p})^\T (WB)^+W \]&lt;br /&gt;
is linear in $\mathcal{L}$. This follows from the fact that if $\mathcal{L} = \mathcal{L}_1 + \mathcal{L}_2$, the vector of&lt;br /&gt;
derivative values $(\mathcal{L}\b{b})(\vec{p}) = ((\mathcal{L}_1 + \mathcal{L}_2)\b{b})(\vec{p}) = &lt;br /&gt;
 (\mathcal{L}_1\b{b} + \mathcal{L}_2\b{b})(\vec{p}) =  (\mathcal{L}_1\b{b})(\vec p) +  (\mathcal{L}_2\b{b})(\vec p)$ &lt;br /&gt;
and consequently&lt;br /&gt;
$$\b{\chi}_{\mathcal{L}}(\vec{p}) = \b{\chi}_{\mathcal{L}_1}(\vec{p}) + \b{\chi}_{\mathcal{L}_2}(\vec{p}).$$&lt;br /&gt;
&lt;br /&gt;
Say that your equation constitutes of operators up to a certain $k$-th order.&lt;br /&gt;
Then it is sufficient to compute only shape functions for the basis of that operator space, namely&lt;br /&gt;
\[&lt;br /&gt;
\{\b{\chi}_{\frac{\partial}{\partial x^\alpha}, p}, 1 \leq |\alpha| \leq k \}, \text{ where } \frac{\partial}{\partial x^\alpha} = \frac{\partial^{|\alpha|}}{\partial x_1^{\alpha_1}\cdots \partial x_d^{\alpha_d}} \text{ and } |\alpha| = \sum_{i=1}^d \alpha_i.&lt;br /&gt;
\]&lt;br /&gt;
Having the shape functions $\b{\chi}_{\frac{\partial}{\partial x^\alpha}, p}$ available, we write $\mathcal{L}$ in the above basis in point $p$, $\mathcal{L} = \displaystyle \sum_{1 \leq |\alpha| \leq k} a_\alpha(p) \frac{\partial}{\partial x^\alpha}$&lt;br /&gt;
and evaluate it's shape function as &lt;br /&gt;
\[&lt;br /&gt;
  \b{\chi}_{\mathcal{L}, \vec{p}} = \sum_{1 \leq |\alpha| \leq k}  a_\alpha(p) \b{\chi}_{\frac{\partial}{\partial x^\alpha}, p}.&lt;br /&gt;
\]&lt;br /&gt;
This saves us space and gives certain elegance to the implementation.&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Computation_of_shape_functions&amp;diff=3036</id>
		<title>Computation of shape functions</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Computation_of_shape_functions&amp;diff=3036"/>
				<updated>2020-08-29T09:24:41Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Another view on derivation of shape functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Shape functions, often called stencil weights, are functionals, approximating linear partial differential operators at a chosen point. &lt;br /&gt;
A shape function $\b{\chi}_{\mathcal{L}} (\vec{p})$ for a linear parial differential operator $\mathcal{L}$&lt;br /&gt;
in a point $p$ is a vector of stencil weights, such that&lt;br /&gt;
\[&lt;br /&gt;
(\mathcal{L} u)(\vec{p}) \approx \b{\chi}_{\mathcal{L}}(\vec{p})^\T \b{u},&lt;br /&gt;
\]&lt;br /&gt;
where $\b{u}$ is a vector of function values $u(x_i)$ evaluated in the support of $\vec{p}$.&lt;br /&gt;
For usage examples see the section on [[Meshless Local Strong Form Method (MLSM)]] or some [[ Poisson's equation | examples ]].&lt;br /&gt;
&lt;br /&gt;
For computation of shape functions augmented with monomials, see the [[ Radial basis function-generated finite differences (RBF-FD) ]].&lt;br /&gt;
&lt;br /&gt;
== Derivation ==&lt;br /&gt;
Let $\mathcal{L}$ be a linear partial differential operator.&lt;br /&gt;
We wish to approximate $(\mathcal{L}u)(\vec{p})$ using only values of $u$ in support of $p$. To do so, we construct a &lt;br /&gt;
WLS approximation (see [[Weighted Least Squares (WLS)]]) and compute the coefficients $\b{\alpha}$, such that $\hat{u}(\vec{p}) = \b{b}(\vec{p})^\T \b{\alpha}$.&lt;br /&gt;
The coefficients are computed by solving a least-squares system $WB \b{\alpha} = W\b{u}$, (see [[Solving overdetermined systems]])&lt;br /&gt;
writing&lt;br /&gt;
\[ \b{\alpha} = (B^\T W^2 B^\T)^{-1} B^\T W^2 \b{u}. \]&lt;br /&gt;
Writing down the approximation function $\hat{u}$ we get&lt;br /&gt;
\[&lt;br /&gt;
\hat u (\vec{p}) = \b{b}(\vec{p})^\T \b{\alpha} = \b{b}(\vec{p})^\T (WB)^+W\b{u} &lt;br /&gt;
\]&lt;br /&gt;
and applying operator $\mathcal{L}$ we get &lt;br /&gt;
\[&lt;br /&gt;
    \hat u (\vec{p}) = (\mathcal{L}\b{b})(\vec{p})^\T \b{\alpha} = &lt;br /&gt;
(\mathcal{L}\b{b})(\vec{p})^\T (B^\T W^2 B)^{-1} B^\T W^2 \b{u} &lt;br /&gt;
= \b{\chi}_{\mathcal{L}}(\vec{p})^\T \b{u}&lt;br /&gt;
\]&lt;br /&gt;
&lt;br /&gt;
Depending on what data we have available, we can either compute $\b \alpha$ and obtain a continuous approximation $\hat{u}$,&lt;br /&gt;
to which $\mathcal{L}$ can be applied at any point, or, if function values $\b u$ are unknown, we can choose to compute&lt;br /&gt;
$\b \chi_{\mathcal{L}}$ at a point $\vec p$ and approximate the operator for ''any'' set of function values. &lt;br /&gt;
the operator $\mathcal{L}$ at $\vec p$ is approximated as &lt;br /&gt;
\[&lt;br /&gt;
  (\mathcal{L}u)(\vec{p}) \approx (\mathcal{L} \hat{u})(p) = \b{\chi}_{\mathcal{L}}(\vec{p})^\T \b{u}.&lt;br /&gt;
\]&lt;br /&gt;
Vector $\b{\chi}$ is a vector of stencil weights, also called a ''shape function''. The name comes historically from FEM, and it incorporates the idea of being able to take all the information&lt;br /&gt;
about shape of the local domain and choice of approximation and store it in a single vector, being able to approximate&lt;br /&gt;
a function value from given support values $\b{u}$ with a single dot product. For any values $\b{u}$, value $\b{\chi}(p) \b{u}$&lt;br /&gt;
gives us the approximation of $(\mathcal{L}u)(\vec{p})$.&lt;br /&gt;
Mathematically speaking, $\b{\chi}(\vec{p})$ is a Riesz representation of a functional, $\b{\chi}(\vec{p})\colon \R^n \to \R$, mapping $n$-tuples of known function values to&lt;br /&gt;
approximations of $\mathcal{L}$ in point $\vec{p}$.&lt;br /&gt;
&lt;br /&gt;
For example, take a $1$-dimensional case for approximation of derivatives with weight equal to $1$ and $n=m=3$, with equally spaced support values at distances $h$.&lt;br /&gt;
We wish to approximate $u''$ in the middle support point, just by making a weighted sum of the values, something like the finite difference&lt;br /&gt;
\[ u'' \approx \frac{u_1 - 2u_2 + u_3}{h^2}. \]&lt;br /&gt;
This is exactly the same formula as we would have come to by computing $\b{\chi}$, except that our approach is a lot more general. But one should think about&lt;br /&gt;
$\b{\chi}$ as one would about the finite difference scheme, it is a rule, telling us how to compute the derivative.&lt;br /&gt;
\[ u''(s_2) \approx \underbrace{\begin{bmatrix} \frac{1}{h^2} &amp;amp; \frac{-2}{h^2} &amp;amp; \frac{1}{h^2} \end{bmatrix}}_{\b{\chi}^\T} \begin{bmatrix}u_1 \\ u_2 \\ u_3 \end{bmatrix}  \]&lt;br /&gt;
&lt;br /&gt;
The fact that $\b{\chi}$ is independent of the function values $\b{u}$ but depend only on domain geometry means that&lt;br /&gt;
'''we can just compute the shape functions $\b{\chi}$ for points of interest and then approximate any linear operator&lt;br /&gt;
of any function, given its values, very fast, using only a single dot product.'''&lt;br /&gt;
&lt;br /&gt;
== Special case when $B$ is square and invertible ==&lt;br /&gt;
The expression&lt;br /&gt;
\[ \b{\chi}_{\mathcal{L}}(\vec{p})^\T = (\mathcal{L}\b{b})(\vec{p})^\T (B^\T W^2 B)^{-1} B^\T W^2 \]&lt;br /&gt;
can be simplified to &lt;br /&gt;
\[&lt;br /&gt;
  \b \chi_{\mathcal{L}}(\vec{p})^\T = (\mathcal{L}\b{b})(\vec{p})^\T B^{-1}.&lt;br /&gt;
\]&lt;br /&gt;
&lt;br /&gt;
This gives the approximation as $(\mathcal{L} \hat{u})(p) = (\mathcal{L}\b{b})(\vec{p})^\T B^{-1} \b u$. &lt;br /&gt;
&lt;br /&gt;
Coefficients $\b \alpha$ are the solutions of $B\b \alpha = \b u$. Shape function $\b{\chi}_{\mathcal{L}}(\vec{p})$ is defined as&lt;br /&gt;
$$ &lt;br /&gt;
\b{\chi}_{\mathcal{L}}(\vec{p})^\T = (\mathcal{L}\b{b})(\vec{p})^\T B^{-1},&lt;br /&gt;
$$&lt;br /&gt;
which can be rewritten as a solution of &lt;br /&gt;
$$ B^\T \b{\chi}_{\mathcal{L}}(\vec{p}) =  (\mathcal{L}\b{b})(\vec{p}). $$&lt;br /&gt;
&lt;br /&gt;
This formulation is more suitable for numerical solving and also has a deeper interpretation, as presented in the next section.&lt;br /&gt;
&lt;br /&gt;
== Another view on derivation of shape functions ==&lt;br /&gt;
Solving the system $B^\T \b{\chi}_{\mathcal{L}} (\vec{p})^\T = (\mathcal{L}\b{b})(\vec p)$ can be interpreted as using the method of undetermined coefficients.&lt;br /&gt;
&lt;br /&gt;
We wish to find such a combination of function values evaluated in support points $\vec s_i$ that approximates the value of an operator $(\mathcal{L}u)(\vec p)$, i.e., we are looking for coefficients $\chi_{\mathcal{L}, i}$, such that&lt;br /&gt;
\[ \sum_{i=1}^n \chi_{\mathcal{L}, i} u_i \approx (\mathcal{L}u)(p). \]&lt;br /&gt;
&lt;br /&gt;
We require that $\chi_{\mathcal{L}, i}$ be such, that above approximations holds for a certain space of functions, spanned by the basis $\{b_j\}_{j=1}^m$.&lt;br /&gt;
By choosing the basis functions $b_j$ we decide for which functions the aproximation $\b{\chi}_{\mathcal{L}, \vec{p}} \b{u} \approx (\mathcal{L}u)(\vec p)$ should be exact and we write the equations &lt;br /&gt;
$\sum_{i=1}^n \chi_{\mathcal{L}, i} b_j(\vec s_i) = (\mathcal{L}b_j)(\vec p)$ in a system:&lt;br /&gt;
\[&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
  b_1(\vec s_1) &amp;amp; \cdots &amp;amp; b_1(\vec s_n) \\&lt;br /&gt;
  \vdots &amp;amp; \ddots &amp;amp; \vdots \\&lt;br /&gt;
  b_m(\vec s_1) &amp;amp; \cdots &amp;amp; b_m(\vec s_n) \\&lt;br /&gt;
\end{bmatrix}&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
 \chi_{\mathcal{L}, 1} \\ \vdots \\ \chi_{\mathcal{L}, n}&lt;br /&gt;
\end{bmatrix}&lt;br /&gt;
=&lt;br /&gt;
\begin{bmatrix}&lt;br /&gt;
  (\mathcal{L} b_1)(\vec{p}) \\ \vdots \\ (\mathcal{L} b_m)(\vec{p})&lt;br /&gt;
\end{bmatrix}&lt;br /&gt;
\]&lt;br /&gt;
Note that the matrix above is precisely the transpose of the matrix $B$ from the [[Weighted Least Squares (WLS) ]] approximation. In this sense, the computation of &lt;br /&gt;
shape functions is dual to computation of basis coefficients. The system is written in matrix form as $B^\T \b{\chi}_{\mathcal{L}} (\vec{p})^\T = (\mathcal{L}\b{b})(\vec p)$. &lt;br /&gt;
&lt;br /&gt;
For $n=m$ case as in the previous section, the solution is the sought shape function $\b{\chi}_{\mathcal L}$.&lt;br /&gt;
&lt;br /&gt;
If we do not specify enough functions $b_j$, the system above is underdetermined.&lt;br /&gt;
A common solution is to minimize the weighted norm of $\b \chi_{\mathcal L}$.&lt;br /&gt;
This gives us a minimization problem&lt;br /&gt;
$$&lt;br /&gt;
 \min_{\b \chi_{\mathcal L}} \sum_{i=1}^n (\chi_{\mathcal{L}, i}/w_i)^2, \text{ such that } B^\T \b{\chi}_{\mathcal{L}} (\vec{p})^\T = (\mathcal{L}\b{b})(\vec p).&lt;br /&gt;
$$&lt;br /&gt;
If the central weights are bigger, this also forces the central coefficients to be larger.&lt;br /&gt;
&lt;br /&gt;
Using the solution derived in [[Solving underdetermined systems]] and substituting inverse weights $W = W^{-1}$ and matrix $A = B^\T$, we get the solution&lt;br /&gt;
$$&lt;br /&gt;
\b{\chi}_{\mathcal{L}} (\vec{p}) = (W^{-1})^{-2} (B^\T)^\T (B^\T (W^{-1})^{-2}(B^\T)^\T) (\mathcal{L}\b{b})(\vec p) = W^2 B (B^\T W^2 B)^{-1} (\mathcal{L}\b{b})(\vec p).&lt;br /&gt;
$$&lt;br /&gt;
After transposing, we get&lt;br /&gt;
$$&lt;br /&gt;
\b{\chi}_{\mathcal{L}} (\vec{p})^\T = (\mathcal{L}\b{b})(\vec p)^\T (B^\T W^2 B)^{-1} B^\T W^2,&lt;br /&gt;
$$&lt;br /&gt;
which is exactly the same formula as derived using [[ Weighted Least Squares (WLS) ]] approximation.&lt;br /&gt;
&lt;br /&gt;
Just as we get the same stencil weights using interpolation and the method of undetermined coefficients, we get the same result using &lt;br /&gt;
WLS approximation or weighted norm minimization of shape functions.&lt;br /&gt;
&lt;br /&gt;
== Numerical calculation of the shape functions ==&lt;br /&gt;
Numerically cheaper and more stable way is to translate the problem of inverting the matrix to solving a linear system of equations.&lt;br /&gt;
The alternative view above is useful in this aspect.&lt;br /&gt;
&lt;br /&gt;
=== Invertible $B$ ===&lt;br /&gt;
&lt;br /&gt;
If $B$ is invertible, then $\b{\chi}_{\mathcal{L}}(\vec{p})$ can be thought as a solution of a system $B^\T\b{\chi}_{\mathcal{L}}(\vec{p}) = (\mathcal{L}\b{b})(\vec p)$, which can be solved using LU or Cholesky decomposition for example.&lt;br /&gt;
For more on this, see [[Solving linear systems]].&lt;br /&gt;
&lt;br /&gt;
=== General case ===&lt;br /&gt;
In general, the system $B^\T\b{\chi}_{\mathcal{L}}(\vec{p}) = (\mathcal{L}\b{b})(\vec p)$ is underdetermined and must be solved in the least-weighted-norm sense.&lt;br /&gt;
This means solving the underdetermined system $B^\T W y =  (\mathcal{L}\b{b})(\vec p)$ and computing $\b{\chi}_{\mathcal{L}}(\vec{p}) = Wy$.&lt;br /&gt;
For more details on this, see [[Solving underdetermined systems]]. &lt;br /&gt;
&lt;br /&gt;
Depending on our knowledge of the &lt;br /&gt;
problem, we can use Cholesky ($B^\T W$ is positive definite), $LDL^\T$ if it is symmetric, $LU$ for a general square matrix, $QR$ for full rank overdetermined system and SVD for a general system.&lt;br /&gt;
&lt;br /&gt;
If more shapes need to be calculated using the same matrix $B^\T W$ and only different right hand sides (as is often the case, if shapes for more than one operator are computed), &lt;br /&gt;
it can be done efficiently by storing the decomposition of $B^\T W$.&lt;br /&gt;
&lt;br /&gt;
== Linearity and reduction to only computing the shapes of the operator space basis ==&lt;br /&gt;
Observe that the expression for the shape functions&lt;br /&gt;
\[ \b{\chi}_{\mathcal{L}}(\vec{p}) = (\mathcal{L}\b{b})(\vec{p})^\T (WB)^+W \]&lt;br /&gt;
is linear in $\mathcal{L}$. This follows from the fact that if $\mathcal{L} = \mathcal{L}_1 + \mathcal{L}_2$, the vector of&lt;br /&gt;
derivative values $(\mathcal{L}\b{b})(\vec{p}) = ((\mathcal{L}_1 + \mathcal{L}_2)\b{b})(\vec{p}) = &lt;br /&gt;
 (\mathcal{L}_1\b{b} + \mathcal{L}_2\b{b})(\vec{p}) =  (\mathcal{L}_1\b{b})(\vec p) +  (\mathcal{L}_2\b{b})(\vec p)$ &lt;br /&gt;
and consequently&lt;br /&gt;
$$\b{\chi}_{\mathcal{L}}(\vec{p}) = \b{\chi}_{\mathcal{L}_1}(\vec{p}) + \b{\chi}_{\mathcal{L}_2}(\vec{p}).$$&lt;br /&gt;
&lt;br /&gt;
Say that your equation constitutes of operators up to a certain $k$-th order.&lt;br /&gt;
Then it is sufficient to compute only shape functions for the basis of that operator space, namely&lt;br /&gt;
\[&lt;br /&gt;
\{\b{\chi}_{\frac{\partial}{\partial x^\alpha}, p}, 1 \leq |\alpha| \leq k \}, \text{ where } \frac{\partial}{\partial x^\alpha} = \frac{\partial^{|\alpha|}}{\partial x_1^{\alpha_1}\cdots \partial x_d^{\alpha_d}} \text{ and } |\alpha| = \sum_{i=1}^d \alpha_i.&lt;br /&gt;
\]&lt;br /&gt;
Having the shape functions $\b{\chi}_{\frac{\partial}{\partial x^\alpha}, p}$ available, we write $\mathcal{L}$ in the above basis in point $p$, $\mathcal{L} = \displaystyle \sum_{1 \leq |\alpha| \leq k} a_\alpha(p) \frac{\partial}{\partial x^\alpha}$&lt;br /&gt;
and evaluate it's shape function as &lt;br /&gt;
\[&lt;br /&gt;
  \b{\chi}_{\mathcal{L}, \vec{p}} = \sum_{1 \leq |\alpha| \leq k}  a_\alpha(p) \b{\chi}_{\frac{\partial}{\partial x^\alpha}, p}.&lt;br /&gt;
\]&lt;br /&gt;
This saves us space and gives certain elegance to the implementation.&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=How_to_build&amp;diff=2935</id>
		<title>How to build</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=How_to_build&amp;diff=2935"/>
				<updated>2020-07-06T19:09:54Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: /* Linker errors */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Installation=&lt;br /&gt;
To make this work from plain Ubuntu installation, run&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo apt-get install git g++ python3 cmake libhdf5-serial-dev doxygen graphviz&lt;br /&gt;
git clone https://gitlab.com/e62Lab/medusa.git --branch master --single-branch&lt;br /&gt;
cd medusa&lt;br /&gt;
./run_tests.py&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
which installs dependencies, clones the repository, goes into the root folder of&lt;br /&gt;
the repository and runs tests.  This will build and run all tests. If this&lt;br /&gt;
works, you are ready to go! Otherwise install any missing packages and if it&lt;br /&gt;
still fails, raise an issue!&lt;br /&gt;
&lt;br /&gt;
For instructions on how to use this library in you project, see&lt;br /&gt;
[[Including this library in your project]].&lt;br /&gt;
&lt;br /&gt;
=Building=&lt;br /&gt;
&lt;br /&gt;
List of dependencies:&lt;br /&gt;
&lt;br /&gt;
* Build tools, like &amp;lt;code&amp;gt; cmake &amp;gt;= 2.8.12&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt; g++ &amp;gt;= 4.8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;python3&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://www.hdfgroup.org/ HDF5 library] for IO &lt;br /&gt;
* &amp;lt;code&amp;gt;doxygen &amp;gt;=  1.8.8 &amp;lt;/code&amp;gt; and Graphviz for generating the documentation&lt;br /&gt;
&lt;br /&gt;
Out of source builds are preferred. Run&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir -p build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note that you only have to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once, after that only &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; is sufficient.&lt;br /&gt;
&lt;br /&gt;
Binaries are placed into &amp;lt;code&amp;gt;bin/&amp;lt;/code&amp;gt; folder. Tests can be run all at once via &amp;lt;code&amp;gt;make medusa_run_tests&amp;lt;/code&amp;gt; &lt;br /&gt;
or individually via e. g. &amp;lt;code&amp;gt;make operators_run_tests&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Linker errors ==&lt;br /&gt;
&lt;br /&gt;
When trying out different classes, you might come along linker errors such as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
Scanning dependencies of target cantilever_beam&lt;br /&gt;
[100%] Building CXX object examples/linear_elasticity/CMakeFiles/cantilever_beam.dir/cantilever_beam.cpp.o&lt;br /&gt;
[100%] Linking CXX executable ../../../examples/linear_elasticity/cantilever_beam&lt;br /&gt;
/usr/bin/ld: CMakeFiles/cantilever_beam.dir/cantilever_beam.cpp.o: in function `main':&lt;br /&gt;
cantilever_beam.cpp:(.text.startup+0x162): undefined reference to `void mm::FindBalancedSupport::operator()&amp;lt;mm::DomainDiscretization&amp;lt;Eigen::Matrix&amp;lt;double, 2, 1, 0, 2, 1&amp;gt; &amp;gt; &amp;gt;(mm::DomainDiscretization&amp;lt;Eigen::Matrix&amp;lt;double, 2, 1, 0, 2, 1&amp;gt; &amp;gt;&amp;amp;) const'&lt;br /&gt;
collect2: error: ld returned 1 exit status&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is expected and is the result of some optimizations of compilation time. The medusa library can actually be included in two ways: as&lt;br /&gt;
&amp;lt;code&amp;gt;#include &amp;lt;medusa/Medusa_fwd.hpp&amp;gt;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;#include &amp;lt;medusa/Medusa.hpp&amp;gt;&amp;lt;/code&amp;gt;. The first version contains the declarations of all symbols, but not all the definitions. Some of the more commonly used template instantiations are included, but by far not all. Using a template instantiation that is not precompiled will cause your program to compile fine, but will fail to link, due to the missing definitions. In this case you have a few options: include the &amp;lt;i&amp;gt;full&amp;lt;/i&amp;gt; Medusa library (the header without the &amp;lt;code&amp;gt;_fwd&amp;lt;/code&amp;gt;) and it should just work, but you will have to wait a bit longer for it to compile. Include only the missing header (in the case above &amp;lt;code&amp;gt;medusa/bits/domains/FindBalancedSupport.hpp&amp;lt;/code&amp;gt;) and pay for whay you use. Or, add your instantiation among the already precompiled instantiations (located in &amp;lt;code&amp;gt;.cpp&amp;lt;/code&amp;gt; files, such as e.g. [https://gitlab.com/e62Lab/medusa/-/blob/dev/src/domains/DomainDiscretization.cpp this one]).&lt;br /&gt;
&lt;br /&gt;
== Building on macOS ==&lt;br /&gt;
This method was tested on macOS Mojave 10.14.2.&lt;br /&gt;
&lt;br /&gt;
First install Xcode via App Store and then Xcode Command Line Tools with&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, install all dependencies from homebrew&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install cmake hdf5 boost python doxygen graphviz&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can clone and build the project using the following commands&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git clone https://gitlab.com/e62Lab/medusa.git&lt;br /&gt;
cd medusa&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
cd ..&lt;br /&gt;
python3 run_tests.py&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will also run all tests. If it works, you are ready to go! Otherwise install any missing packages and if it still fails, raise an issue!&lt;br /&gt;
&lt;br /&gt;
==HDF5==&lt;br /&gt;
In order to use HDF5 IO you need the [https://www.hdfgroup.org/ HDF5 library].&lt;br /&gt;
You can install it easily using the command &amp;lt;code&amp;gt;sudo apt-get install libhdf5-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
or &amp;lt;code&amp;gt;sudo pacman -S hdf5&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Ubuntu places (at least on older versions) hdf5 headers and libraries in a weird folder &lt;br /&gt;
&amp;lt;code&amp;gt;/usr/{lib, include}/x86_64-linux-gnu/hdf5/serial/&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If you get an error like &amp;lt;code&amp;gt;HDF5 sample failed to compile.  See errors above.&amp;lt;/code&amp;gt; during &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; execution&lt;br /&gt;
then the sample hdf test file located in &amp;lt;code&amp;gt;test/test_hdf_compile.cpp&amp;lt;/code&amp;gt; failed to compile. Perhaps it is good to make this file compile first, &lt;br /&gt;
before tackling the whole project. &lt;br /&gt;
&lt;br /&gt;
If you get an error similar to &amp;lt;code&amp;gt;fatal error: hdf5.h: No such file or directory&amp;lt;/code&amp;gt;,&lt;br /&gt;
then your compiler cannot see the HDF5 header files. Some distributions, notably (older) Ubuntu, place them into nonstandard folders&lt;br /&gt;
&amp;lt;code&amp;gt;/usr/include/hdf5/serial/&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;/usr/include/x86_64-linux-gnu/hdf5/serial/&amp;lt;/code&amp;gt;.&lt;br /&gt;
Check these two folders or check your distributions hdf package for the locations of these files.&lt;br /&gt;
After you have determined the location, add that directory to the include directories,&lt;br /&gt;
using -I flag or in &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; by using&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
include_directories(/usr/include/hdf5/serial/)  # or your appropriate directory&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If you wish to fix this problem permanently, you can create soft links to the headers in your &amp;lt;code&amp;gt;/usr/include&amp;lt;/code&amp;gt; directory, &lt;br /&gt;
by typing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo ln -s /usr/include/hdf5/serial/* /usr/include&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
After this, there should be no compile time errors. If there are, please raise an issue.&lt;br /&gt;
&lt;br /&gt;
If you get error similar to &amp;lt;code&amp;gt;-lhdf5 not found&amp;lt;/code&amp;gt; and you have hdf5 installed, &lt;br /&gt;
you might have to link the libraries into a discoverable place, like &amp;lt;code&amp;gt;/usr/lib/&amp;lt;/code&amp;gt; &lt;br /&gt;
or add the above directory to the linker path. Similarly to above, check the &amp;lt;code&amp;gt;/usr/lib/x86_64-linux-gnu/hdf5/serial/&amp;lt;/code&amp;gt;&lt;br /&gt;
directory and look for file &amp;lt;code&amp;gt;libhdf5.a&amp;lt;/code&amp;gt;. When found,&lt;br /&gt;
specify the location using -L flag or &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; by using&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
link_directories(/usr/lib/x86_64-linux-gnu/hdf5/serial/)  # or your appropriate directory&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or fix the problem permanently by soft-linking&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo ln -s /usr/lib/x86_64-linux-gnu/hdf5/serial/* /usr/lib&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Linear Algebra==&lt;br /&gt;
We use [http://eigen.tuxfamily.org/ Eigen] as our matrix library. See&lt;br /&gt;
[http://eigen.tuxfamily.org/dox-devel/group__QuickRefPage.html here] for use&lt;br /&gt;
reference and documentation. For a quick transition from Matlab see&lt;br /&gt;
[http://eigen.tuxfamily.org/dox/AsciiQuickReference.txt here].&lt;br /&gt;
&lt;br /&gt;
== Using Intel Math Kernel Library (MKL) ==&lt;br /&gt;
Install [https://software.intel.com/en-us/mkl Intel MKL] and take not of installation directories.&lt;br /&gt;
&lt;br /&gt;
Proper include and link directories need to be set to use the Intel MKL. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
include_directories(SYSTEM /opt/intel/compilers_and_libraries/linux/mkl/include)    # change these to your installation path&lt;br /&gt;
link_directories(SYSTEM /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64)&lt;br /&gt;
link_directories(SYSTEM /opt/intel/compilers_and_libraries/linux/lib/intel64)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eigen has great support for MKL. You can see more detailed instructions [https://eigen.tuxfamily.org/dox/TopicUsingIntelMKL.html on their website].&lt;br /&gt;
To use MKL for math operations, define &amp;lt;code&amp;gt;EIGEN_USE_MKL_VML&amp;lt;/code&amp;gt; when compiling. You must also link&lt;br /&gt;
the appropriate libraries and define &amp;lt;code&amp;gt;MKL_LP64&amp;lt;/code&amp;gt; for use on a 64bit system.&lt;br /&gt;
With parallelism enabled, the configuration looks as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
target_compile_options(my_target PRIVATE &amp;quot;-fopenmp&amp;quot;)&lt;br /&gt;
target_compile_definitions(my_target PUBLIC EIGEN_USE_MKL_VML MKL_LP64)&lt;br /&gt;
target_link_libraries(my_target medusa mkl_intel_lp64 mkl_intel_thread mkl_core pthread iomp5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have Intel Parallel Studio installed this also enables you to use the Pardiso paralle direct sparse solver through its [https://eigen.tuxfamily.org/dox/group__PardisoSupport__Module.html Eigen interface].&lt;br /&gt;
&lt;br /&gt;
== Using Intel C/C++ Compiler ==&lt;br /&gt;
&lt;br /&gt;
In order to use Intel's compiler when compiling Medusa, you have several standard optionas for &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt;.&lt;br /&gt;
Make sure compilers and installed and in your &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; by running &amp;lt;code&amp;gt;which icc&amp;lt;/code&amp;gt;, which &lt;br /&gt;
should return something like &amp;lt;code&amp;gt;/opt/intel/bin/icc&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can define the compiler when *first* calling cmake like so&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cmake .. -DCMAKE_C_COMPILER=$(which icc) -DCMAKE_CXX_COMPILER=$(which icpc) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If this is not your first call, remove the &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; directory and start anew.&lt;br /&gt;
&lt;br /&gt;
You can also set the &amp;lt;code&amp;gt;CXX&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;CC&amp;lt;/code&amp;gt; bash variables. Before calling&lt;br /&gt;
&amp;lt;code&amp;gt; cmake &amp;lt;/code&amp;gt; for the first time you have to export the following:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export CXX=&amp;quot;icpc&amp;quot;&lt;br /&gt;
export CC=&amp;quot;icc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
You can also compile it directly for Intel® Xeon Phi™ Coprocessor. You do this by adding &amp;lt;code&amp;gt;-Dmmic=ON&amp;lt;/code&amp;gt;&lt;br /&gt;
flag to the &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cmake .. -Dmmic=ON -DCMAKE_C_COMPILER=$(which icc) -DCMAKE_CXX_COMPILER=$(which icpc) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; All features that depend on system third-party libraries are not available on MIC (Many Integrated Core).&lt;br /&gt;
This includes:&lt;br /&gt;
&lt;br /&gt;
* HDF class in &amp;lt;code&amp;gt;io.hpp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=How_to_build&amp;diff=2934</id>
		<title>How to build</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=How_to_build&amp;diff=2934"/>
				<updated>2020-07-06T19:09:09Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Installation=&lt;br /&gt;
To make this work from plain Ubuntu installation, run&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo apt-get install git g++ python3 cmake libhdf5-serial-dev doxygen graphviz&lt;br /&gt;
git clone https://gitlab.com/e62Lab/medusa.git --branch master --single-branch&lt;br /&gt;
cd medusa&lt;br /&gt;
./run_tests.py&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
which installs dependencies, clones the repository, goes into the root folder of&lt;br /&gt;
the repository and runs tests.  This will build and run all tests. If this&lt;br /&gt;
works, you are ready to go! Otherwise install any missing packages and if it&lt;br /&gt;
still fails, raise an issue!&lt;br /&gt;
&lt;br /&gt;
For instructions on how to use this library in you project, see&lt;br /&gt;
[[Including this library in your project]].&lt;br /&gt;
&lt;br /&gt;
=Building=&lt;br /&gt;
&lt;br /&gt;
List of dependencies:&lt;br /&gt;
&lt;br /&gt;
* Build tools, like &amp;lt;code&amp;gt; cmake &amp;gt;= 2.8.12&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt; g++ &amp;gt;= 4.8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;python3&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://www.hdfgroup.org/ HDF5 library] for IO &lt;br /&gt;
* &amp;lt;code&amp;gt;doxygen &amp;gt;=  1.8.8 &amp;lt;/code&amp;gt; and Graphviz for generating the documentation&lt;br /&gt;
&lt;br /&gt;
Out of source builds are preferred. Run&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir -p build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note that you only have to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once, after that only &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; is sufficient.&lt;br /&gt;
&lt;br /&gt;
Binaries are placed into &amp;lt;code&amp;gt;bin/&amp;lt;/code&amp;gt; folder. Tests can be run all at once via &amp;lt;code&amp;gt;make medusa_run_tests&amp;lt;/code&amp;gt; &lt;br /&gt;
or individually via e. g. &amp;lt;code&amp;gt;make operators_run_tests&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Linker errors ==&lt;br /&gt;
&lt;br /&gt;
When trying out different classes, you might come along linker errors such as &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
Scanning dependencies of target cantilever_beam&lt;br /&gt;
[100%] Building CXX object examples/linear_elasticity/CMakeFiles/cantilever_beam.dir/cantilever_beam.cpp.o&lt;br /&gt;
[100%] Linking CXX executable ../../../examples/linear_elasticity/cantilever_beam&lt;br /&gt;
/usr/bin/ld: CMakeFiles/cantilever_beam.dir/cantilever_beam.cpp.o: in function `main':&lt;br /&gt;
cantilever_beam.cpp:(.text.startup+0x162): undefined reference to `void mm::FindBalancedSupport::operator()&amp;lt;mm::DomainDiscretization&amp;lt;Eigen::Matrix&amp;lt;double, 2, 1, 0, 2, 1&amp;gt; &amp;gt; &amp;gt;(mm::DomainDiscretization&amp;lt;Eigen::Matrix&amp;lt;double, 2, 1, 0, 2, 1&amp;gt; &amp;gt;&amp;amp;) const'&lt;br /&gt;
collect2: error: ld returned 1 exit status&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is expected and is the result of some optimizations of compilation time. The medusa library can actually be included in two ways: as&lt;br /&gt;
&amp;lt;code&amp;gt;#include &amp;lt;medusa/Medusa_fwd.hpp&amp;gt;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;#include &amp;lt;medusa/Medusa.hpp&amp;gt;&amp;lt;/code&amp;gt;. The first version contains the declarations of all symbols, but not all the definitions. Some of the more commonly used template instantiations are included, but by far not all. Using a template instantiation that is not precompiled will cause your program to compile fine, but will fail to link, due to the missing definitions. In this case you have a few options: include the &amp;lt;i&amp;gt;full&amp;lt;/i&amp;gt; Medusa library (without &amp;lt;code&amp;gt;_fwd&amp;lt;/code&amp;gt; and it should just work, but you will have to wait a bit longer for it to compile. Include only the missing header (in the case above &amp;lt;code&amp;gt;medusa/bits/domains/FindBalancedSupport.hpp&amp;lt;/code&amp;gt;) and pay for whay you use. Or, add your instantiation among the already precompiled instantiations (located in &amp;lt;code&amp;gt;.cpp&amp;lt;/code&amp;gt; files, such as e.g. [https://gitlab.com/e62Lab/medusa/-/blob/dev/src/domains/DomainDiscretization.cpp this one]).&lt;br /&gt;
&lt;br /&gt;
== Building on macOS ==&lt;br /&gt;
This method was tested on macOS Mojave 10.14.2.&lt;br /&gt;
&lt;br /&gt;
First install Xcode via App Store and then Xcode Command Line Tools with&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, install all dependencies from homebrew&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install cmake hdf5 boost python doxygen graphviz&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can clone and build the project using the following commands&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git clone https://gitlab.com/e62Lab/medusa.git&lt;br /&gt;
cd medusa&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
cd ..&lt;br /&gt;
python3 run_tests.py&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will also run all tests. If it works, you are ready to go! Otherwise install any missing packages and if it still fails, raise an issue!&lt;br /&gt;
&lt;br /&gt;
==HDF5==&lt;br /&gt;
In order to use HDF5 IO you need the [https://www.hdfgroup.org/ HDF5 library].&lt;br /&gt;
You can install it easily using the command &amp;lt;code&amp;gt;sudo apt-get install libhdf5-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
or &amp;lt;code&amp;gt;sudo pacman -S hdf5&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Ubuntu places (at least on older versions) hdf5 headers and libraries in a weird folder &lt;br /&gt;
&amp;lt;code&amp;gt;/usr/{lib, include}/x86_64-linux-gnu/hdf5/serial/&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If you get an error like &amp;lt;code&amp;gt;HDF5 sample failed to compile.  See errors above.&amp;lt;/code&amp;gt; during &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; execution&lt;br /&gt;
then the sample hdf test file located in &amp;lt;code&amp;gt;test/test_hdf_compile.cpp&amp;lt;/code&amp;gt; failed to compile. Perhaps it is good to make this file compile first, &lt;br /&gt;
before tackling the whole project. &lt;br /&gt;
&lt;br /&gt;
If you get an error similar to &amp;lt;code&amp;gt;fatal error: hdf5.h: No such file or directory&amp;lt;/code&amp;gt;,&lt;br /&gt;
then your compiler cannot see the HDF5 header files. Some distributions, notably (older) Ubuntu, place them into nonstandard folders&lt;br /&gt;
&amp;lt;code&amp;gt;/usr/include/hdf5/serial/&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;/usr/include/x86_64-linux-gnu/hdf5/serial/&amp;lt;/code&amp;gt;.&lt;br /&gt;
Check these two folders or check your distributions hdf package for the locations of these files.&lt;br /&gt;
After you have determined the location, add that directory to the include directories,&lt;br /&gt;
using -I flag or in &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; by using&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
include_directories(/usr/include/hdf5/serial/)  # or your appropriate directory&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If you wish to fix this problem permanently, you can create soft links to the headers in your &amp;lt;code&amp;gt;/usr/include&amp;lt;/code&amp;gt; directory, &lt;br /&gt;
by typing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo ln -s /usr/include/hdf5/serial/* /usr/include&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
After this, there should be no compile time errors. If there are, please raise an issue.&lt;br /&gt;
&lt;br /&gt;
If you get error similar to &amp;lt;code&amp;gt;-lhdf5 not found&amp;lt;/code&amp;gt; and you have hdf5 installed, &lt;br /&gt;
you might have to link the libraries into a discoverable place, like &amp;lt;code&amp;gt;/usr/lib/&amp;lt;/code&amp;gt; &lt;br /&gt;
or add the above directory to the linker path. Similarly to above, check the &amp;lt;code&amp;gt;/usr/lib/x86_64-linux-gnu/hdf5/serial/&amp;lt;/code&amp;gt;&lt;br /&gt;
directory and look for file &amp;lt;code&amp;gt;libhdf5.a&amp;lt;/code&amp;gt;. When found,&lt;br /&gt;
specify the location using -L flag or &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; by using&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
link_directories(/usr/lib/x86_64-linux-gnu/hdf5/serial/)  # or your appropriate directory&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or fix the problem permanently by soft-linking&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo ln -s /usr/lib/x86_64-linux-gnu/hdf5/serial/* /usr/lib&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Linear Algebra==&lt;br /&gt;
We use [http://eigen.tuxfamily.org/ Eigen] as our matrix library. See&lt;br /&gt;
[http://eigen.tuxfamily.org/dox-devel/group__QuickRefPage.html here] for use&lt;br /&gt;
reference and documentation. For a quick transition from Matlab see&lt;br /&gt;
[http://eigen.tuxfamily.org/dox/AsciiQuickReference.txt here].&lt;br /&gt;
&lt;br /&gt;
== Using Intel Math Kernel Library (MKL) ==&lt;br /&gt;
Install [https://software.intel.com/en-us/mkl Intel MKL] and take not of installation directories.&lt;br /&gt;
&lt;br /&gt;
Proper include and link directories need to be set to use the Intel MKL. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
include_directories(SYSTEM /opt/intel/compilers_and_libraries/linux/mkl/include)    # change these to your installation path&lt;br /&gt;
link_directories(SYSTEM /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64)&lt;br /&gt;
link_directories(SYSTEM /opt/intel/compilers_and_libraries/linux/lib/intel64)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eigen has great support for MKL. You can see more detailed instructions [https://eigen.tuxfamily.org/dox/TopicUsingIntelMKL.html on their website].&lt;br /&gt;
To use MKL for math operations, define &amp;lt;code&amp;gt;EIGEN_USE_MKL_VML&amp;lt;/code&amp;gt; when compiling. You must also link&lt;br /&gt;
the appropriate libraries and define &amp;lt;code&amp;gt;MKL_LP64&amp;lt;/code&amp;gt; for use on a 64bit system.&lt;br /&gt;
With parallelism enabled, the configuration looks as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
target_compile_options(my_target PRIVATE &amp;quot;-fopenmp&amp;quot;)&lt;br /&gt;
target_compile_definitions(my_target PUBLIC EIGEN_USE_MKL_VML MKL_LP64)&lt;br /&gt;
target_link_libraries(my_target medusa mkl_intel_lp64 mkl_intel_thread mkl_core pthread iomp5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have Intel Parallel Studio installed this also enables you to use the Pardiso paralle direct sparse solver through its [https://eigen.tuxfamily.org/dox/group__PardisoSupport__Module.html Eigen interface].&lt;br /&gt;
&lt;br /&gt;
== Using Intel C/C++ Compiler ==&lt;br /&gt;
&lt;br /&gt;
In order to use Intel's compiler when compiling Medusa, you have several standard optionas for &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt;.&lt;br /&gt;
Make sure compilers and installed and in your &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; by running &amp;lt;code&amp;gt;which icc&amp;lt;/code&amp;gt;, which &lt;br /&gt;
should return something like &amp;lt;code&amp;gt;/opt/intel/bin/icc&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can define the compiler when *first* calling cmake like so&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cmake .. -DCMAKE_C_COMPILER=$(which icc) -DCMAKE_CXX_COMPILER=$(which icpc) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If this is not your first call, remove the &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; directory and start anew.&lt;br /&gt;
&lt;br /&gt;
You can also set the &amp;lt;code&amp;gt;CXX&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;CC&amp;lt;/code&amp;gt; bash variables. Before calling&lt;br /&gt;
&amp;lt;code&amp;gt; cmake &amp;lt;/code&amp;gt; for the first time you have to export the following:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export CXX=&amp;quot;icpc&amp;quot;&lt;br /&gt;
export CC=&amp;quot;icc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
You can also compile it directly for Intel® Xeon Phi™ Coprocessor. You do this by adding &amp;lt;code&amp;gt;-Dmmic=ON&amp;lt;/code&amp;gt;&lt;br /&gt;
flag to the &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cmake .. -Dmmic=ON -DCMAKE_C_COMPILER=$(which icc) -DCMAKE_CXX_COMPILER=$(which icpc) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; All features that depend on system third-party libraries are not available on MIC (Many Integrated Core).&lt;br /&gt;
This includes:&lt;br /&gt;
&lt;br /&gt;
* HDF class in &amp;lt;code&amp;gt;io.hpp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=How_to_build&amp;diff=2933</id>
		<title>How to build</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=How_to_build&amp;diff=2933"/>
				<updated>2020-07-06T18:56:11Z</updated>
		
		<summary type="html">&lt;p&gt;Jureslak: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Installation=&lt;br /&gt;
To make this work from plain Ubuntu installation, run&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo apt-get install git g++ python3 cmake libhdf5-serial-dev doxygen graphviz&lt;br /&gt;
git clone https://gitlab.com/e62Lab/medusa.git --branch master --single-branch&lt;br /&gt;
cd medusa&lt;br /&gt;
./run_tests.py&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
which installs dependencies, clones the repository, goes into the root folder of&lt;br /&gt;
the repository and runs tests.  This will build and run all tests. If this&lt;br /&gt;
works, you are ready to go! Otherwise install any missing packages and if it&lt;br /&gt;
still fails, raise an issue!&lt;br /&gt;
&lt;br /&gt;
For instructions on how to use this library in you project, see&lt;br /&gt;
[[Including this library in your project]].&lt;br /&gt;
&lt;br /&gt;
=Building=&lt;br /&gt;
&lt;br /&gt;
List of dependencies:&lt;br /&gt;
&lt;br /&gt;
* Build tools, like &amp;lt;code&amp;gt; cmake &amp;gt;= 2.8.12&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt; g++ &amp;gt;= 4.8&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;python3&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://www.hdfgroup.org/ HDF5 library] for IO &lt;br /&gt;
* &amp;lt;code&amp;gt;doxygen &amp;gt;=  1.8.8 &amp;lt;/code&amp;gt; and Graphviz for generating the documentation&lt;br /&gt;
&lt;br /&gt;
Out of source builds are preferred. Run&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir -p build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
make&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note that you only have to run &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; once, after that only &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt; is sufficient.&lt;br /&gt;
&lt;br /&gt;
Binaries are placed into &amp;lt;code&amp;gt;bin/&amp;lt;/code&amp;gt; folder. Tests can be run all at once via &amp;lt;code&amp;gt;make medusa_run_tests&amp;lt;/code&amp;gt; &lt;br /&gt;
or individually via e. g. &amp;lt;code&amp;gt;make operators_run_tests&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Linker errors ==&lt;br /&gt;
&lt;br /&gt;
== Building on macOS ==&lt;br /&gt;
This method was tested on macOS Mojave 10.14.2.&lt;br /&gt;
&lt;br /&gt;
First install Xcode via App Store and then Xcode Command Line Tools with&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
xcode-select --install&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, install all dependencies from homebrew&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
brew install cmake hdf5 boost python doxygen graphviz&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can clone and build the project using the following commands&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
git clone https://gitlab.com/e62Lab/medusa.git&lt;br /&gt;
cd medusa&lt;br /&gt;
mkdir build&lt;br /&gt;
cd build&lt;br /&gt;
cmake ..&lt;br /&gt;
cd ..&lt;br /&gt;
python3 run_tests.py&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will also run all tests. If it works, you are ready to go! Otherwise install any missing packages and if it still fails, raise an issue!&lt;br /&gt;
&lt;br /&gt;
==HDF5==&lt;br /&gt;
In order to use HDF5 IO you need the [https://www.hdfgroup.org/ HDF5 library].&lt;br /&gt;
You can install it easily using the command &amp;lt;code&amp;gt;sudo apt-get install libhdf5-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
or &amp;lt;code&amp;gt;sudo pacman -S hdf5&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Ubuntu places (at least on older versions) hdf5 headers and libraries in a weird folder &lt;br /&gt;
&amp;lt;code&amp;gt;/usr/{lib, include}/x86_64-linux-gnu/hdf5/serial/&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
If you get an error like &amp;lt;code&amp;gt;HDF5 sample failed to compile.  See errors above.&amp;lt;/code&amp;gt; during &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; execution&lt;br /&gt;
then the sample hdf test file located in &amp;lt;code&amp;gt;test/test_hdf_compile.cpp&amp;lt;/code&amp;gt; failed to compile. Perhaps it is good to make this file compile first, &lt;br /&gt;
before tackling the whole project. &lt;br /&gt;
&lt;br /&gt;
If you get an error similar to &amp;lt;code&amp;gt;fatal error: hdf5.h: No such file or directory&amp;lt;/code&amp;gt;,&lt;br /&gt;
then your compiler cannot see the HDF5 header files. Some distributions, notably (older) Ubuntu, place them into nonstandard folders&lt;br /&gt;
&amp;lt;code&amp;gt;/usr/include/hdf5/serial/&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;/usr/include/x86_64-linux-gnu/hdf5/serial/&amp;lt;/code&amp;gt;.&lt;br /&gt;
Check these two folders or check your distributions hdf package for the locations of these files.&lt;br /&gt;
After you have determined the location, add that directory to the include directories,&lt;br /&gt;
using -I flag or in &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; by using&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
include_directories(/usr/include/hdf5/serial/)  # or your appropriate directory&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If you wish to fix this problem permanently, you can create soft links to the headers in your &amp;lt;code&amp;gt;/usr/include&amp;lt;/code&amp;gt; directory, &lt;br /&gt;
by typing&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo ln -s /usr/include/hdf5/serial/* /usr/include&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
After this, there should be no compile time errors. If there are, please raise an issue.&lt;br /&gt;
&lt;br /&gt;
If you get error similar to &amp;lt;code&amp;gt;-lhdf5 not found&amp;lt;/code&amp;gt; and you have hdf5 installed, &lt;br /&gt;
you might have to link the libraries into a discoverable place, like &amp;lt;code&amp;gt;/usr/lib/&amp;lt;/code&amp;gt; &lt;br /&gt;
or add the above directory to the linker path. Similarly to above, check the &amp;lt;code&amp;gt;/usr/lib/x86_64-linux-gnu/hdf5/serial/&amp;lt;/code&amp;gt;&lt;br /&gt;
directory and look for file &amp;lt;code&amp;gt;libhdf5.a&amp;lt;/code&amp;gt;. When found,&lt;br /&gt;
specify the location using -L flag or &amp;lt;code&amp;gt;CMakeLists.txt&amp;lt;/code&amp;gt; by using&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
link_directories(/usr/lib/x86_64-linux-gnu/hdf5/serial/)  # or your appropriate directory&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or fix the problem permanently by soft-linking&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo ln -s /usr/lib/x86_64-linux-gnu/hdf5/serial/* /usr/lib&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Linear Algebra==&lt;br /&gt;
We use [http://eigen.tuxfamily.org/ Eigen] as our matrix library. See&lt;br /&gt;
[http://eigen.tuxfamily.org/dox-devel/group__QuickRefPage.html here] for use&lt;br /&gt;
reference and documentation. For a quick transition from Matlab see&lt;br /&gt;
[http://eigen.tuxfamily.org/dox/AsciiQuickReference.txt here].&lt;br /&gt;
&lt;br /&gt;
== Using Intel Math Kernel Library (MKL) ==&lt;br /&gt;
Install [https://software.intel.com/en-us/mkl Intel MKL] and take not of installation directories.&lt;br /&gt;
&lt;br /&gt;
Proper include and link directories need to be set to use the Intel MKL. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
include_directories(SYSTEM /opt/intel/compilers_and_libraries/linux/mkl/include)    # change these to your installation path&lt;br /&gt;
link_directories(SYSTEM /opt/intel/compilers_and_libraries/linux/mkl/lib/intel64)&lt;br /&gt;
link_directories(SYSTEM /opt/intel/compilers_and_libraries/linux/lib/intel64)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Eigen has great support for MKL. You can see more detailed instructions [https://eigen.tuxfamily.org/dox/TopicUsingIntelMKL.html on their website].&lt;br /&gt;
To use MKL for math operations, define &amp;lt;code&amp;gt;EIGEN_USE_MKL_VML&amp;lt;/code&amp;gt; when compiling. You must also link&lt;br /&gt;
the appropriate libraries and define &amp;lt;code&amp;gt;MKL_LP64&amp;lt;/code&amp;gt; for use on a 64bit system.&lt;br /&gt;
With parallelism enabled, the configuration looks as follows&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cmake&amp;quot;&amp;gt;&lt;br /&gt;
target_compile_options(my_target PRIVATE &amp;quot;-fopenmp&amp;quot;)&lt;br /&gt;
target_compile_definitions(my_target PUBLIC EIGEN_USE_MKL_VML MKL_LP64)&lt;br /&gt;
target_link_libraries(my_target medusa mkl_intel_lp64 mkl_intel_thread mkl_core pthread iomp5)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have Intel Parallel Studio installed this also enables you to use the Pardiso paralle direct sparse solver through its [https://eigen.tuxfamily.org/dox/group__PardisoSupport__Module.html Eigen interface].&lt;br /&gt;
&lt;br /&gt;
== Using Intel C/C++ Compiler ==&lt;br /&gt;
&lt;br /&gt;
In order to use Intel's compiler when compiling Medusa, you have several standard optionas for &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt;.&lt;br /&gt;
Make sure compilers and installed and in your &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; by running &amp;lt;code&amp;gt;which icc&amp;lt;/code&amp;gt;, which &lt;br /&gt;
should return something like &amp;lt;code&amp;gt;/opt/intel/bin/icc&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can define the compiler when *first* calling cmake like so&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cmake .. -DCMAKE_C_COMPILER=$(which icc) -DCMAKE_CXX_COMPILER=$(which icpc) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If this is not your first call, remove the &amp;lt;code&amp;gt;build&amp;lt;/code&amp;gt; directory and start anew.&lt;br /&gt;
&lt;br /&gt;
You can also set the &amp;lt;code&amp;gt;CXX&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;CC&amp;lt;/code&amp;gt; bash variables. Before calling&lt;br /&gt;
&amp;lt;code&amp;gt; cmake &amp;lt;/code&amp;gt; for the first time you have to export the following:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export CXX=&amp;quot;icpc&amp;quot;&lt;br /&gt;
export CC=&amp;quot;icc&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
You can also compile it directly for Intel® Xeon Phi™ Coprocessor. You do this by adding &amp;lt;code&amp;gt;-Dmmic=ON&amp;lt;/code&amp;gt;&lt;br /&gt;
flag to the &amp;lt;code&amp;gt;cmake&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cmake .. -Dmmic=ON -DCMAKE_C_COMPILER=$(which icc) -DCMAKE_CXX_COMPILER=$(which icpc) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Note:&amp;lt;/b&amp;gt; All features that depend on system third-party libraries are not available on MIC (Many Integrated Core).&lt;br /&gt;
This includes:&lt;br /&gt;
&lt;br /&gt;
* HDF class in &amp;lt;code&amp;gt;io.hpp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jureslak</name></author>	</entry>

	</feed>