deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
vector_tools_common.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2020 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_vector_tools_common_h
14#define dealii_vector_tools_common_h
15
16
17#include <deal.II/base/config.h>
18
20
22
23namespace VectorTools
24{
272
277 "The given point is inside a cell of a "
278 "parallel::distributed::Triangulation that is not "
279 "locally owned by this processor.");
280} // namespace VectorTools
281
282// Make sure we can use NormType with Patterns.
283namespace Patterns
284{
285 namespace Tools
286 {
287 template <>
288 struct Convert<VectorTools::NormType, void>
289 {
293 static std::unique_ptr<Patterns::PatternBase>
295 {
296 return std::make_unique<Patterns::Selection>(
297 "mean|L1_norm|L2_norm|Lp_norm|"
298 "Linfty_norm|H1_seminorm|Hdiv_seminorm|"
299 "H1_norm|W1p_seminorm|W1p_norm|"
300 "W1infty_seminorm|W1infty_norm");
301 }
302
303
304
308 static std::string
310 const Patterns::PatternBase &p =
312 {
313 std::string str;
314 if (s == VectorTools::mean)
315 str = "mean";
316 else if (s == VectorTools::L1_norm)
317 str = "L1_norm";
318 else if (s == VectorTools::L2_norm)
319 str = "L2_norm";
320 else if (s == VectorTools::Lp_norm)
321 str = "Lp_norm";
322 else if (s == VectorTools::Linfty_norm)
323 str = "Linfty_norm";
324 else if (s == VectorTools::H1_seminorm)
325 str = "H1_seminorm";
326 else if (s == VectorTools::Hdiv_seminorm)
327 str = "Hdiv_seminorm";
328 else if (s == VectorTools::H1_norm)
329 str = "H1_norm";
330 else if (s == VectorTools::W1p_seminorm)
331 str = "W1p_seminorm";
332 else if (s == VectorTools::W1infty_seminorm)
333 str = "W1infty_seminorm";
334 else if (s == VectorTools::W1infty_norm)
335 str = "W1infty_norm";
336 else if (s == VectorTools::W1p_norm)
337 str = "W1p_norm";
338 else
339 {
340 AssertThrow(false, ExcMessage("Didn't recognize a norm type."));
341 }
342 AssertThrow(p.match(str), ExcInternalError());
343 return str;
344 }
345
346
351 to_value(const std::string &str,
352 const Patterns::PatternBase &p =
354 {
356 AssertThrow(p.match(str),
358 "String " + str +
359 " cannot be converted to VectorTools::NormType"));
360
361 if (str == "mean")
362 norm = VectorTools::mean;
363 else if (str == "L1_norm")
365 else if (str == "L2_norm")
367 else if (str == "Lp_norm")
369 else if (str == "Linfty_norm")
371 else if (str == "H1_seminorm")
373 else if (str == "Hdiv_seminorm")
375 else if (str == "H1_norm")
377 else if (str == "W1p_seminorm")
379 else if (str == "W1infty_seminorm")
381 else if (str == "W1infty_norm")
383 else if (str == "W1p_norm")
385 else
386 {
387 AssertThrow(false, ExcMessage("Didn't recognize a norm type."));
388 }
389 return norm;
390 }
391 };
392 } // namespace Tools
393} // namespace Patterns
394
396
397#endif // dealii_vector_tools_common_h
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define DeclExceptionMsg(Exception, defaulttext)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcPointNotAvailableHere()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
static std::unique_ptr< Patterns::PatternBase > to_pattern()
static std::string to_string(const VectorTools::NormType &s, const Patterns::PatternBase &p= *Convert< VectorTools::NormType >::to_pattern())
static VectorTools::NormType to_value(const std::string &str, const Patterns::PatternBase &p= *Convert< VectorTools::NormType >::to_pattern())