<commit_before>// Copyright (c) 2010-2021, Lawrence Livermore National Security, LLC. Produced
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
// LICENSE and NOTICE for details. LLNL-CODE-806117.
//
// This file is part of the MFEM library. For more information and source code
// availability visit https://mfem.org.
//
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
//
//            -------------------------------------------------
//            Distance Miniapp: Finite element distance solver
//            -------------------------------------------------
//
// This miniapp computes the "distance" to a given point source or to the zero
// level set of a given function. Here "distance" refers to the length of the
// shortest path through the mesh. The input can be a DeltaCoefficient (for
// a point source), or any Coefficient (for the case of a level set). The
// output is a GridFunction that can be scalar (representing the scalar
// distance), or a vector (its magnitude is the distance, and its direction is
// the starting direction of the shortest path). The miniapp supports 2 solvers:
//
// 1. Heat solver:
//    Crane, Weischedel, Weischedel
//    Geodesics in Heat: A New Approach to Computing Distance Based on Heat Flow
//    ACM Transactions on Graphics, Vol. 32, No. 5, October, 2013
// 2. p-Laplacian solver:
//    Belyaev, Fayolle
//    On Variational and PDE-based Distance Function Approximations,
//    Computer Graphics Forum, 34: 104-118, 2015
//
//    <NAME>. & <NAME>.
//    Approximate Methods of Higher Analysis, Interscience Publishers, Inc., 1958
//
//    <NAME>. & <NAME>.
//    The partition of unity finite element method: Basic theory and applications,
//    Computer Methods in Applied Mechanics and Engineering, 1996, 139, 289-314
//
//
// Compile with: make distance
//
// Sample runs:
//   Problem 0: point source.
//     mpirun -np 4 distance -m ./corners.mesh -p 0 -rs 3 -t 200.0
//
//   Problem 1: zero level set - circle / sphere at the center of the mesh
//     mpirun -np 4 distance -m ../../data/inline-quad.mesh -rs 3 -o 2 -t 4.0 -p 1
//     mpirun -np 4 distance -m ../../data/periodic-cube.mesh -rs 2 -o 2 -t 1.0 -p 1 -s 1
//
//   Problem 2: zero level set - perturbed sine.
//     mpirun -np 4 distance -m ../../data/inline-quad.mesh -rs 3 -o 2 -t 2.0 -p 2
//
//   Problem 3: level set - Gyroid.
//      mpirun -np 4 distance -m ../../data/periodic-square.mesh -rs 5 -o 2 -t 1.0 -p 3<commit_msg>more documentation<commit_after>// Copyright (c) 2010-2021, Lawrence Livermore National Security, LLC. Produced
// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
// LICENSE and NOTICE for details. LLNL-CODE-806117.
//
// This file is part of the MFEM library. For more information and source code
// availability visit https://mfem.org.
//
// MFEM is free software; you can redistribute it and/or modify it under the
// terms of the BSD-3 license. We welcome feedback and contributions, see file
// CONTRIBUTING.md for details.
//
//            -------------------------------------------------
//            Distance Miniapp: Finite element distance solver
//            -------------------------------------------------
//
// This miniapp computes the "distance" to a given point source or to the zero
// level set of a given function. Here "distance" refers to the length of the
// shortest path through the mesh. The input can be a DeltaCoefficient (for
// a point source), or any Coefficient (for the case of a level set). The
// output is a GridFunction that can be scalar (representing the scalar
// distance), or a vector (its magnitude is the distance, and its direction is
// the starting direction of the shortest path). The miniapp supports 2 solvers:
//
// 1. Heat solver:
//    Crane, Weischedel, Weischedel
//    Geodesics in Heat: A New Approach to Computing Distance Based on Heat Flow
//    ACM Transactions on Graphics, Vol. 32, No. 5, October, 2013
// 2. p-Laplacian solver:
//    Belyaev, Fayolle
//    On Variational and PDE-based Distance Function Approximations,
//    Computer Graphics Forum, 34: 104-118, 2015
//
//    The solution of the p-Laplacian solver approaches the signed distance 
//    function when p->\infinity. Therefore, increasing p will improve the 
//    computed distance and, of course, will increase the computational cost. 
//    The discretization of the p-Laplacian equation utilizes ideas from:
//
//    <NAME>. & <NAME>.
//    Approximate Methods of Higher Analysis, Interscience Publishers, Inc., 1958
//
//    <NAME>. & <NAME>.
//    The partition of unity finite element method: Basic theory and applications,
//    Computer Methods in Applied Mechanics and Engineering, 1996, 139, 289-314
//
//
//    Resolving highly oscillatory input fields requires refining the mesh or 
//    increasing the order of the approximation. The above requirement for mesh 
//    resolution is independent of the conditions imposed on the mesh by the 
//    discretization of the actual distance solver. On the other hand, it is 
//    often enough to compute the distance field to a mean zero level of a 
//    smoothed version of the input field. In such cases, one can use a 
//    low-pass filter that removes the high-frequency content of the input 
//    field. Such filter is implemented in the class PDEFilter based on the 
//    Screened Poisson equation. The radius specifies the minimal feature size 
//    in the filter output and, in the current example, is linked to the average 
//    mesh size. Theoretical description of the filter and discussion of the 
//    parameters can be found in:
//
//    <NAME>. & <NAME>.
//    Filters in topology optimization based on Helmholtz-type differential equations
//    International Journal for Numerical Methods in Engineering, 2011, 86, 765-781
//
// Compile with: make distance
//
// Sample runs:
//   Problem 0: point source.
//     mpirun -np 4 distance -m ./corners.mesh -p 0 -rs 3 -t 200.0
//
//   Problem 1: zero level set - circle / sphere at the center of the mesh
//     mpirun -np 4 distance -m ../../data/inline-quad.mesh -rs 3 -o 2 -t 4.0 -p 1
//     mpirun -np 4 distance -m ../../data/periodic-cube.mesh -rs 2 -o 2 -t 1.0 -p 1 -s 1
//
//   Problem 2: zero level set - perturbed sine.
//     mpirun -np 4 distance -m ../../data/inline-quad.mesh -rs 3 -o 2 -t 2.0 -p 2
//
//   Problem 3: level set - Gyroid.
//      mpirun -np 4 distance -m ../../data/periodic-square.mesh -rs 5 -o 2 -t 1.0 -p 3
{'fraction_non_alphanumeric': 0.12886752778612195, 'fraction_numerical': 0.02883748873535596, 'mean_word_length': 2.298167409608717, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 14, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3937085', 'n_tokens_mistral': 2051, 'n_tokens_neox': 1795, 'n_words': 901}