This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "libmesh/node.h" | |
#include "libmesh/elem.h" | |
#include "libmesh/mesh.h" | |
#include "libmesh/face_tri3.h" | |
#include "libmesh/getpot.h" | |
using namespace libMesh; | |
// Commands to approximately generate the Bassi & Rebay meshes: | |
// In my opinion, the meshes look best when nodes_per_ring = 2 * num_rings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
struct S | |
{ | |
S(const S&) { std::cout << "Copied an S\n"; } | |
S(S&&) { std::cout << "Moved an S\n"; } | |
S() = default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C++ include files that we need | |
#include <iostream> | |
// Basic include files needed for the mesh functionality. | |
#include "libmesh/libmesh.h" | |
#include "libmesh/mesh.h" | |
#include "libmesh/mesh_generation.h" | |
#include "libmesh/linear_implicit_system.h" | |
#include "libmesh/equation_systems.h" | |
#include "libmesh/exodusII_io.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compilation requires -std=c++17 | |
// http://stackoverflow.com/questions/17603666/copy-move-requirements-for-the-key-value-types-in-a-stdmap | |
#include <map> | |
#include <vector> | |
struct foo | |
{ | |
int i; | |
foo(int j) : i(j) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An FEM formulation for solving the Jeffery-Hamel ODE: | |
// f''' + 2 * alpha * Re * f * f' + 4 * alpha^2 * f' = 0 | |
// using C1 Hermite cubic and quartic finite elements. | |
// Libmesh includes | |
#include "libmesh/mesh.h" | |
#include "libmesh/elem.h" | |
#include "libmesh/mesh_generation.h" | |
#include "libmesh/equation_systems.h" | |
#include "libmesh/linear_implicit_system.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MPI headers so we can make a parallel example | |
#include <mpi.h> | |
// Suppress warnings about missing overrides in VTK headers | |
#ifdef __clang__ | |
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Winconsistent-missing-override" | |
#endif | |
#include "vtkVersionMacros.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Originally got this code from http://www.vtk.org/Wiki/VTK_Autoconf | |
// 5.x | |
// #include "vtkConfigure.h" | |
// 7.x | |
// Suppress warnings about missing overrides in VTK headers | |
#ifdef __clang__ | |
#pragma clang diagnostic push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script solves the 3rd-order Jeffery-Hamel ODE: | |
f''' + 2*Re*alpha*f*f' + 4*alpha*alpha*f' = 0 | |
f(0) = 1 | |
f(1) = 0 | |
f'(0) = 0 | |
as three ODEs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "libmesh/libmesh.h" | |
#include "libmesh/mesh.h" | |
#include "libmesh/mesh_generation.h" | |
#include "libmesh/elem.h" | |
#include "libmesh/fe.h" | |
#include "libmesh/quadrature_gauss.h" | |
#include "libmesh/getpot.h" | |
#include "libmesh/mesh_modification.h" | |
#include "libmesh/cell_hex27.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <chrono> | |
#include <stdlib.h> // RAND_MAX | |
// In this case, N is a compile time global constant. | |
const unsigned int N = 1000; | |
typedef double ** Matrix; |