74 GetPot cl(argc, argv);
76 const std::string elem_type_string =
82 const int denominator =
85 const bool diff = cl.search(
"--diff");
88 Utility::string_to_enum<ElemType>(elem_type_string);
92 std::unique_ptr<Elem> elem = Elem::build(elem_type);
97 FEType fe_type(elem->default_order());
99 const unsigned int n_nodes = FEInterface::n_dofs(fe_type, elem.get());
100 libmesh_error_msg_if(
n_nodes != elem->n_nodes(),
"Bad FEInterface value?");
102 std::vector<Node> nodes(
n_nodes);
112 nodes[v] = ref.
point(n);
113 elem->set_node(v, &nodes[v]);
115 else if (embed != 0.0)
116 libmesh_error_msg(
"Found fractional embedding on vertex!?");
127 for (
auto pbn : pbns)
128 nodes[n] += (ref.
point(pbn.first) + ref.
point(pbn.second))/2;
129 nodes[n] /= pbns.size();
130 elem->set_node(n, &nodes[n]);
133 const unsigned int denomdigits = std::ceil(std::log10(denominator));
134 const unsigned int spacing = denomdigits*2+3;
136 std::cout.precision(17);
138 std::cout <<
" // embedding matrix for child " << childnum <<
'\n';
143 const unsigned int indexdigits =
144 std::ceil(std::log10(i));
145 const int padding = spacing-indexdigits-2*(i==0);
146 for (
int k=0; k < padding; ++k)
157 const Point & pt = elem->point(i);
161 Real shape = FEInterface::shape(fe_type, elem.get(), j, pt);
171 for (
unsigned int k=0; k != spacing; ++k)
178 int oldnumerator =
int(std::round(shape*denominator));
179 int newnumerator = oldnumerator;
180 int newdenominator = denominator;
184 int the_gcd = std::gcd(newnumerator, newdenominator);
185 newnumerator /= the_gcd;
186 newdenominator /= the_gcd;
189 const unsigned int newdenomdigits =
190 std::ceil(std::log10(newdenominator));
191 std::ostringstream ostr;
192 ostr << (shape*newdenominator);
194 (shape != 0.0 && newdenominator != 1) ?
195 int(spacing)-newdenomdigits-2-ostr.str().size() :
196 int(spacing)-ostr.str().size();
197 for (
int k=0; k < padding; ++k)
199 std::cout << ostr.str();
200 if (shape != 0.0 && newdenominator != 1)
202 if (1 << (
int)std::round(std::log2(newdenominator)) ==
204 std::cout <<
"/" << newdenominator <<
'.';
209 std::cout <<
"/r" << newdenominator;
221 std::cout <<
"// " << i <<
'\n';
223 std::cout <<
" },\n";
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
ElemType
Defines an enum for geometric element types.
static constexpr Real TOLERANCE
This is the base class from which all geometric element types are derived.
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
virtual Real embedding_matrix(const unsigned int child_num, const unsigned int child_node_num, const unsigned int parent_node_num) const =0
const dof_id_type n_nodes
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
T assert_argument(GetPot &cl, const std::string &argname, const char *progname, const T &defaultarg)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
The 2-parameter make_range() helper function returns an IntRange<T> when both input parameters are of...
virtual const std::vector< std::pair< unsigned char, unsigned char > > & parent_bracketing_nodes(unsigned int c, unsigned int n) const
A Point defines a location in LIBMESH_DIM dimensional Real space.
const Point & point(const unsigned int i) const
void ErrorVector unsigned int
const Elem & get(const ElemType type_in)