This file contains hidden or 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/elem.h" | |
| #include "libmesh/mesh_generation.h" | |
| #include "libmesh/mesh_modification.h" | |
| using namespace libMesh; | |
| int main (int argc, char** argv) | |
| { |
This file contains hidden or 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
| int mystery(int n) | |
| { | |
| int i = 1; | |
| switch (n) | |
| { | |
| case 8: i*=2; case 7: i*=2; | |
| case 6: i*=2; case 5: i*=2; | |
| case 4: i*=2; case 3: i*=2; | |
| case 2: i*=2; case 1: i*=2; |
This file contains hidden or 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> | |
| int main(int argc, const char * argv[]) | |
| { | |
| typedef std::vector<std::vector<double>> Matrix; | |
| Matrix matrix(100); | |
| for (unsigned int row=0; row<matrix.size(); ++row) |
This file contains hidden or 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 | |
| typedef std::vector<std::vector<double>> Matrix; | |
| // Function prototypes | |
| void print(const Matrix & matrix); | |
| void resize(Matrix & matrix, unsigned int N); |
This file contains hidden or 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; | |
| // Note the weird syntax for typedef'ing a fixed size array... | |
| typedef double Matrix[N][N]; |
This file contains hidden or 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; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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" |