Skip to content

Commit 44983e2

Browse files
committed
Remove error messages from lagrange shape computations in 1D to allow their inlining
refs #4272
1 parent 8d86fc9 commit 44983e2

1 file changed

Lines changed: 11 additions & 44 deletions

File tree

include/fe/fe_lagrange_shape_1D.h

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@ Real fe_lagrange_1D_linear_shape(const unsigned int i,
3939
case 0:
4040
return .5*(1. - xi);
4141

42-
case 1:
43-
return .5*(1. + xi);
44-
4542
default:
46-
libmesh_error_msg("Invalid shape function index i = " << i);
43+
return .5*(1. + xi);
4744
}
4845
}
4946

@@ -63,11 +60,8 @@ Real fe_lagrange_1D_quadratic_shape(const unsigned int i,
6360
case 1:
6461
return .5*xi*(xi + 1);
6562

66-
case 2:
67-
return (1. - xi*xi);
68-
6963
default:
70-
libmesh_error_msg("Invalid shape function index i = " << i);
64+
return (1. - xi*xi);
7165
}
7266
}
7367

@@ -90,11 +84,8 @@ Real fe_lagrange_1D_cubic_shape(const unsigned int i,
9084
case 2:
9185
return 27./16.*(1.-xi*xi)*(1./3.-xi);
9286

93-
case 3:
94-
return 27./16.*(1.-xi*xi)*(1./3.+xi);
95-
9687
default:
97-
libmesh_error_msg("Invalid shape function index i = " << i);
88+
return 27./16.*(1.-xi*xi)*(1./3.+xi);
9889
}
9990
}
10091

@@ -116,11 +107,8 @@ Real fe_lagrange_1D_shape(const Order order,
116107
return fe_lagrange_1D_quadratic_shape(i, xi);
117108

118109
// Lagrange cubics
119-
case THIRD:
120-
return fe_lagrange_1D_cubic_shape(i, xi);
121-
122110
default:
123-
libmesh_error_msg("ERROR: Unsupported polynomial order = " << order);
111+
return fe_lagrange_1D_cubic_shape(i, xi);
124112
}
125113
}
126114

@@ -141,11 +129,8 @@ Real fe_lagrange_1D_linear_shape_deriv(const unsigned int i,
141129
case 0:
142130
return -.5;
143131

144-
case 1:
145-
return .5;
146-
147132
default:
148-
libmesh_error_msg("Invalid shape function index i = " << i);
133+
return .5;
149134
}
150135
}
151136

@@ -168,11 +153,8 @@ Real fe_lagrange_1D_quadratic_shape_deriv(const unsigned int i,
168153
case 1:
169154
return xi+.5;
170155

171-
case 2:
172-
return -2.*xi;
173-
174156
default:
175-
libmesh_error_msg("Invalid shape function index i = " << i);
157+
return -2.*xi;
176158
}
177159
}
178160

@@ -198,11 +180,8 @@ Real fe_lagrange_1D_cubic_shape_deriv(const unsigned int i,
198180
case 2:
199181
return 27./16.*(3.*xi*xi-2./3.*xi-1.);
200182

201-
case 3:
202-
return 27./16.*(-3.*xi*xi-2./3.*xi+1.);
203-
204183
default:
205-
libmesh_error_msg("Invalid shape function index i = " << i);
184+
return 27./16.*(-3.*xi*xi-2./3.*xi+1.);
206185
}
207186
}
208187

@@ -222,11 +201,8 @@ Real fe_lagrange_1D_shape_deriv(const Order order,
222201
case SECOND:
223202
return fe_lagrange_1D_quadratic_shape_deriv(i, j, xi);
224203

225-
case THIRD:
226-
return fe_lagrange_1D_cubic_shape_deriv(i, j, xi);
227-
228204
default:
229-
libmesh_error_msg("ERROR: Unsupported polynomial order = " << order);
205+
return fe_lagrange_1D_cubic_shape_deriv(i, j, xi);
230206
}
231207
}
232208

@@ -253,11 +229,8 @@ Real fe_lagrange_1D_quadratic_shape_second_deriv(const unsigned int i,
253229
case 1:
254230
return 1.;
255231

256-
case 2:
257-
return -2.;
258-
259232
default:
260-
libmesh_error_msg("Invalid shape function index i = " << i);
233+
return -2.;
261234
}
262235
}
263236

@@ -282,11 +255,8 @@ Real fe_lagrange_1D_cubic_shape_second_deriv(const unsigned int i,
282255
case 2:
283256
return 27./16.*(6*xi-2./3.);
284257

285-
case 3:
286-
return 27./16.*(-6*xi-2./3.);
287-
288258
default:
289-
libmesh_error_msg("Invalid shape function index i = " << i);
259+
return 27./16.*(-6*xi-2./3.);
290260
}
291261
}
292262

@@ -307,11 +277,8 @@ Real fe_lagrange_1D_shape_second_deriv(const Order order,
307277
case SECOND:
308278
return fe_lagrange_1D_quadratic_shape_second_deriv(i, j, xi);
309279

310-
case THIRD:
311-
return fe_lagrange_1D_cubic_shape_second_deriv(i, j, xi);
312-
313280
default:
314-
libmesh_error_msg("ERROR: Unsupported polynomial order = " << order);
281+
return fe_lagrange_1D_cubic_shape_second_deriv(i, j, xi);
315282
} // end switch (order)
316283
}
317284

0 commit comments

Comments
 (0)