71{
73
74 GetPot cl(argc, argv);
75
76 const std::string elem_type_string =
78
79 const int childnum =
81
82 const int denominator =
84
85 const bool diff = cl.search("--diff");
86
88 Utility::string_to_enum<ElemType>(elem_type_string);
89
90
91
92 std::unique_ptr<Elem> elem =
Elem::build(elem_type);
93
95
96
97 FEType fe_type(elem->default_order());
98
100 libmesh_error_msg_if(
n_nodes != elem->n_nodes(),
"Bad FEInterface value?");
101
102 std::vector<Node> nodes(
n_nodes);
103
104
106 {
108 {
110 if (embed == 1.0)
111 {
112 nodes[v] = ref.
point(n);
113 elem->set_node(v, &nodes[v]);
114 }
115 else if (embed != 0.0)
116 libmesh_error_msg("Found fractional embedding on vertex!?");
117 }
118 }
119
120
122 {
124 if (pbns.empty())
125 libmesh_error();
126
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]);
131 }
132
133 const unsigned int denomdigits = std::ceil(std::log10(denominator));
134 const unsigned int spacing = denomdigits*2+3;
135
136 std::cout.precision(17);
137
138 std::cout << " // embedding matrix for child " << childnum << '\n';
139 std::cout << " {\n";
140 std::cout << " //";
142 {
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)
147 std::cout << ' ';
148 std::cout << i;
150 std::cout << '\n';
151 else
152 std::cout << ',';
153 }
154
156 {
157 const Point & pt = elem->point(i);
158 std::cout << " {";
160 {
162
163
165 shape = 0;
166
168 if (diff &&
170 {
171 for (unsigned int k=0; k != spacing; ++k)
172 std::cout << '+';
174 std::cout << ',';
175 }
176 else
177 {
178 int oldnumerator =
int(std::round(shape*denominator));
179 int newnumerator = oldnumerator;
180 int newdenominator = denominator;
181
183 {
184 int the_gcd = std::gcd(newnumerator, newdenominator);
185 newnumerator /= the_gcd;
186 newdenominator /= the_gcd;
187 }
188
189 const unsigned int newdenomdigits =
190 std::ceil(std::log10(newdenominator));
191 std::ostringstream ostr;
192 ostr << (shape*newdenominator);
193 const int padding =
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)
198 std::cout << ' ';
199 std::cout << ostr.str();
200 if (shape != 0.0 && newdenominator != 1)
201 {
202 if (1 << (int)std::round(std::log2(newdenominator)) ==
203 newdenominator)
204 std::cout << "/" << newdenominator << '.';
205
206
207
208 else
209 std::cout << "/r" << newdenominator;
210 }
212 std::cout << ',';
213 }
214 }
215
217 std::cout << "} ";
218 else
219 std::cout << "}, ";
220
221 std::cout << "// " << i << '\n';
222 }
223 std::cout << " },\n";
224
225 return 0;
226}
void ErrorVector unsigned int
This is the base class from which all geometric element types are derived.
virtual const std::vector< std::pair< unsigned char, unsigned char > > & parent_bracketing_nodes(unsigned int c, unsigned int n) const
const Point & point(const unsigned int i) const
static std::unique_ptr< Elem > build(const ElemType type, Elem *p=nullptr)
virtual Real embedding_matrix(const unsigned int child_num, const unsigned int child_node_num, const unsigned int parent_node_num) const =0
static Real shape(const unsigned int dim, const FEType &fe_t, const ElemType t, const unsigned int i, const Point &p)
static unsigned int n_dofs(const unsigned int dim, const FEType &fe_t, const ElemType t)
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
A Point defines a location in LIBMESH_DIM dimensional Real space.
T assert_argument(GetPot &cl, const std::string &argname, const char *progname, const T &defaultarg)
const Elem & get(const ElemType type_in)
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
ElemType
Defines an enum for geometric element types.
static constexpr Real TOLERANCE
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...
const dof_id_type n_nodes