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 <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 | |
| 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> | |
| 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
| 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 "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
| // C++ include files that we need | |
| #include <iostream> | |
| #include <algorithm> | |
| #include <math.h> | |
| // Basic include file needed for the mesh functionality. | |
| #include "libmesh/libmesh.h" | |
| #include "libmesh/mesh.h" | |
| #include "libmesh/mesh_generation.h" | |
| #include "libmesh/exodusII_io.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 utility code can be used to detect slits in a Mesh. A "slit" | |
| // is a zero-width gap between two elements which should actually be | |
| // neighbors. This can be caused by having duplicate nodes in a mesh | |
| // generated by Cubit. | |
| // | |
| // The following journal file should work in any recent version of Cubit | |
| // to generate a mesh with a bunch of duplicated nodes along an interface. | |
| // This is caused by the user forgetting to call "merge all" after setting | |
| // up his geometry. |
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/dense_vector.h" | |
| #include "libmesh/dense_matrix.h" | |
| #include "libmesh/getpot.h" | |
| #include "libmesh/perf_log.h" | |
| #include <Eigen/SVD> | |
| using namespace libMesh; |
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/dense_vector.h" | |
| #include "libmesh/dense_matrix.h" | |
| #include "libmesh/getpot.h" | |
| #include "libmesh/perf_log.h" | |
| #include <Eigen/SVD> | |
| using namespace libMesh; |