Skip to content

Instantly share code, notes, and snippets.

View bgranzow's full-sized avatar

Brian Granzow bgranzow

  • Sandia National Laboratories
  • Albuquerque, NM
View GitHub Profile
@bgranzow
bgranzow / amr_test2.cpp
Created March 18, 2019 18:24
amr debug unmap parents
#include <Omega_h_amr.hpp>
#include <Omega_h_array_ops.hpp>
#include <Omega_h_build.hpp>
#include <Omega_h_file.hpp>
#include <Omega_h_for.hpp>
#include <Omega_h_map.hpp>
#include <Omega_h_print.hpp>
template <int dim>
#include <Omega_h_amr.hpp>
#include <Omega_h_array_ops.hpp>
#include <Omega_h_build.hpp>
#include <Omega_h_file.hpp>
#include <Omega_h_loop.hpp>
#include <Omega_h_map.hpp>
template <int dim>
double eval_rc(Omega_h::Vector<dim> c);
@bgranzow
bgranzow / osh_tree.cpp
Last active March 2, 2018 15:16
starting point to count new entities for AMR
#include <Omega_h_array_ops.hpp>
#include <Omega_h_build.hpp>
#include <Omega_h_library.hpp>
#include <Omega_h_file.hpp>
#include <Omega_h_hypercube.hpp>
#include <Omega_h_mark.hpp>
#include <Omega_h_mesh.hpp>
int main(int argc, char** argv) {
#include <apf.h>
#include <apfMesh2.h>
#include <apfMDS.h>
#include <apfNumbering.h>
#include <apfShape.h>
#include <gmi_mesh.h>
#include <ma.h>
#include <PCU.h>
#include <pcu_util.h>
@bgranzow
bgranzow / long_refine.cpp
Last active October 19, 2017 02:00
Only mark the longest edge in a given element for refinement
#include <apf.h>
#include <apfMesh2.h>
#include <apfMDS.h>
#include <apfNumbering.h>
#include <apfShape.h>
#include <gmi_mesh.h>
#include <ma.h>
#include <PCU.h>
#include <pcu_util.h>
@bgranzow
bgranzow / copy.cpp
Last active October 7, 2017 15:56
copy one apf mesh to another while retaining previous elem ids
#include <apf.h>
#include <apfMDS.h>
#include <apfMesh2.h>
#include <apfNumbering.h>
#include <apfShape.h>
#include <gmi_mesh.h>
#include <ma.h>
#include <PCU.h>
#include <pcu_util.h>
@bgranzow
bgranzow / coarsen.cpp
Created October 7, 2017 13:09
'Uniform' coarsening
struct UniformCoarsener : public IdentitySizeField
{
UniformCoarsener(Mesh* m):
IdentitySizeField(m)
{
}
bool shouldSplit(Entity*)
{
printf("I SHOULD NOT SPLIT!\n");
return false;
@bgranzow
bgranzow / tagging.cc
Created January 12, 2017 01:41
Convert from a mesh tag to a mesh field
#include <gmi_mesh.h>
#include <apfMDS.h>
#include <apfMesh2.h>
#include <apf.h>
#include <PCU.h>
#include <cassert>
apf::MeshTag* create_my_tag(apf::Mesh* m) {
apf::MeshTag* tag = m->createDoubleTag("my_tag", 1);
apf::MeshEntity* vtx;
@bgranzow
bgranzow / segment_stress.cpp
Last active February 24, 2017 18:20
Stress induced by a single dislocation segment
#include <apf.h>
namespace Dislocation {
static apf::Matrix3x3 outer(
apf::Vector3 const& a,
apf::Vector3 const& b) {
apf::Matrix3x3 r;
for (int i=0; i < 3; ++i)
for (int j=0; j < 3; ++j)
@bgranzow
bgranzow / Makefile
Last active December 1, 2016 16:14
Generate lines embedded in a cube with gmodel
NAME=lines_in_cube
all: $(NAME).vtk
$(NAME).geo: $(NAME).cpp
mpicxx -std=c++11 $(NAME).cpp -o $(NAME) -I${GMODEL_DIR}/include -L${GMODEL_DIR}/lib -lgmodel
./$(NAME) 1
$(NAME).msh: $(NAME).geo
gmsh -3 $(NAME).geo -o $(NAME).msh